cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r591599 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java
Date Sat, 03 Nov 2007 11:30:13 GMT
Author: felixk
Date: Sat Nov  3 04:30:13 2007
New Revision: 591599

URL: http://svn.apache.org/viewvc?rev=591599&view=rev
Log:
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead

Creating new instances of java.lang.Boolean wastes memory, since Boolean objects are immutable
and there are only two useful values of this type.  Use the Boolean.valueOf() method (or Java
1.5 autoboxing) to create Boolean objects instead.

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java?rev=591599&r1=591598&r2=591599&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java
Sat Nov  3 04:30:13 2007
@@ -146,12 +146,12 @@
         this.hasSession = this.session != null;
         if (this.hasSession) {
             this.uploadStatus = new Hashtable();
-            this.uploadStatus.put("started", new Boolean(false));
-            this.uploadStatus.put("finished", new Boolean(false));
+            this.uploadStatus.put("started", Boolean.valueOf(false));
+            this.uploadStatus.put("finished", Boolean.valueOf(false));
             this.uploadStatus.put("sent", new Integer(0));
             this.uploadStatus.put("total", new Integer(request.getContentLength()));
             this.uploadStatus.put("filename",  new String());
-            this.uploadStatus.put("error", new Boolean(false));
+            this.uploadStatus.put("error", Boolean.valueOf(false));
             this.uploadStatus.put("uploadsdone", new Integer(0));
             this.session.setAttribute(UPLOAD_STATUS_SESSION_ATTR, this.uploadStatus);
         }
@@ -159,7 +159,7 @@
         parseParts(request.getContentLength(), request.getContentType(), request.getInputStream());
   
 
         if (this.hasSession) {
-            this.uploadStatus.put("finished", new Boolean(true));
+            this.uploadStatus.put("finished", Boolean.valueOf(true));
         }
 
         return this.parts;    
@@ -285,8 +285,8 @@
         }
         
         if (hasSession) { // upload widget support
-            this.uploadStatus.put("finished", new Boolean(false));
-            this.uploadStatus.put("started", new Boolean(true));
+            this.uploadStatus.put("finished", Boolean.valueOf(false));
+            this.uploadStatus.put("started", Boolean.valueOf(true));
             this.uploadStatus.put("widget", (String)headers.get("name"));
             this.uploadStatus.put("filename", (String)headers.get("filename"));
         }
@@ -310,7 +310,7 @@
                 this.uploadStatus.put("uploadsdone", 
                     new Integer(((Integer)this.uploadStatus.get("uploadsdone")).intValue()
+ 1)
                 );
-                this.uploadStatus.put("error", new Boolean(false));
+                this.uploadStatus.put("error", Boolean.valueOf(false));
             }
         } catch (IOException ioe) {
             // don't let incomplete file uploads pile up in the upload dir.
@@ -319,7 +319,7 @@
             out = null;
             if ( file!=null ) file.delete();
             if (this.hasSession) { // upload widget support
-                this.uploadStatus.put("error", new Boolean(true));
+                this.uploadStatus.put("error", Boolean.valueOf(true));
             }
             throw ioe;
         } finally {



Mime
View raw message