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

Shane Bryzak sbryzak at redhat.com
Mon Jul 2 21:47:29 EDT 2007


  User: sbryzak2
  Date: 07/07/02 21:47:29

  Modified:    ui/src/main/java/org/jboss/seam/ui/component 
                        UIFileUpload.java
  Log:
  fixed infinite loop
  
  Revision  Changes    Path
  1.4       +7 -4      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.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- UIFileUpload.java	20 Jun 2007 12:25:31 -0000	1.3
  +++ UIFileUpload.java	3 Jul 2007 01:47:29 -0000	1.4
  @@ -43,11 +43,14 @@
                  ByteArrayOutputStream bos = new ByteArrayOutputStream();
                  try
                  {
  -                  while (localInputStream.available() > 0)
  +                  byte[] buffer = new byte[512];
  +                  int read = localInputStream.read(buffer);
  +                  while (read != -1)
                     {
  -                     bos.write(localInputStream.read());
  -                     dataBinding.setValue(context.getELContext(), bos.toByteArray());
  +                     bos.write(buffer, 0, read);
  +                     read = localInputStream.read(buffer);
                     }
  +                  dataBinding.setValue(context.getELContext(), bos.toByteArray());                  
                  }
                  catch (IOException e)
                  {
  
  
  



More information about the jboss-cvs-commits mailing list