[jboss-cvs] jboss-seam/ui/src/main/java/org/jboss/seam/ui/component ...

Peter Muir peter at bleepbleep.org.uk
Mon Aug 13 05:27:51 EDT 2007


  User: pmuir   
  Date: 07/08/13 05:27:50

  Modified:    ui/src/main/java/org/jboss/seam/ui/component 
                        UIFileUpload.java
  Log:
  JBSEAM-1790
  
  Revision  Changes    Path
  1.5       +36 -35    jboss-seam/ui/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UIFileUpload.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/ui/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- UIFileUpload.java	3 Jul 2007 01:47:29 -0000	1.4
  +++ UIFileUpload.java	13 Aug 2007 09:27:50 -0000	1.5
  @@ -27,36 +27,38 @@
      @Override
      public void processUpdates(FacesContext context)
      {
  -
  -      if (getLocalInputStream() != null)
  -      {
            ValueExpression dataBinding = getValueExpression("data");
            if (dataBinding != null)
            {
               Class clazz = dataBinding.getType(context.getELContext());
               if (clazz.isAssignableFrom(InputStream.class))
               {
  -               dataBinding.setValue(context.getELContext(), localInputStream);
  +            dataBinding.setValue(context.getELContext(), getLocalInputStream());
               }
               else if (clazz.isAssignableFrom(byte[].class))
               {
  +            byte[] bytes = null;
  +            if (getLocalInputStream() != null)
  +            {
                  ByteArrayOutputStream bos = new ByteArrayOutputStream();
                  try
                  {                  
                     byte[] buffer = new byte[512];
  -                  int read = localInputStream.read(buffer);
  +                  int read = getLocalInputStream().read(buffer);
                     while (read != -1)
                     {
                        bos.write(buffer, 0, read);
  -                     read = localInputStream.read(buffer);
  +                     read = getLocalInputStream().read(buffer);
                     }
  -                  dataBinding.setValue(context.getELContext(), bos.toByteArray());                  
  +                  bytes = bos.toByteArray();              
                  }
                  catch (IOException e)
                  {
                     throw new RuntimeException(e);
                  }
               }
  +            dataBinding.setValue(context.getELContext(), bytes);
  +         }
               
               if (getLocalContentType() != null)
               {
  @@ -86,7 +88,6 @@
               }
            }
         }
  -   }
   
      public String getLocalContentType()
      {
  
  
  



More information about the jboss-cvs-commits mailing list