cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r591605 - in /cocoon/trunk: blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/copletManagement/generation/ core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/
Date Sat, 03 Nov 2007 11:52:52 GMT
Author: felixk
Date: Sat Nov  3 04:52:51 2007
New Revision: 591605

URL: http://svn.apache.org/viewvc?rev=591605&view=rev
Log:
Method invokes inefficient new String() constructor

Creating a new java.lang.String object using the no-argument constructor wastes memory because
the object so created will be functionally indistinguishable from the empty string constant
"".  Java guarantees that identical string constants will be represented by the same String
object.  Therefore, you should just use the empty string constant directly.

Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java?rev=591605&r1=591604&r2=591605&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
Sat Nov  3 04:52:51 2007
@@ -68,8 +68,7 @@
                                   ProfileLS.PROFILETYPE_LAYOUT,
                                   layout,
                                   null);
-        	String xml = new String();
-        	xml = os.toString();
+        	final String xml = os.toString();
             final InputSource inputSource = new InputSource(new StringReader(xml));
             parser = (SAXParser)this.manager.lookup(SAXParser.ROLE);
             parser.parse(inputSource, super.xmlConsumer);

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=591605&r1=591604&r2=591605&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:52:51 2007
@@ -150,7 +150,7 @@
             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("filename", "");
             this.uploadStatus.put("error", Boolean.valueOf(false));
             this.uploadStatus.put("uploadsdone", new Integer(0));
             this.session.setAttribute(UPLOAD_STATUS_SESSION_ATTR, this.uploadStatus);



Mime
View raw message