### Eclipse Workspace Patch 1.0 #P org.eclipse.wst.xml.core Index: src/org/eclipse/wst/xml/core/internal/document/TextImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/TextImpl.java,v retrieving revision 1.17 diff -u -r1.17 TextImpl.java --- src/org/eclipse/wst/xml/core/internal/document/TextImpl.java 16 Sep 2008 05:09:36 -0000 1.17 +++ src/org/eclipse/wst/xml/core/internal/document/TextImpl.java 5 Dec 2009 16:46:12 -0000 @@ -12,7 +12,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -90,7 +90,7 @@ return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String newSource = getSource(arg); @@ -140,7 +140,7 @@ return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } TextImpl text = (TextImpl) newText; @@ -179,15 +179,15 @@ if (count == 0) return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (count < 0 || offset < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String source = getSource(); if (source == null || source.length() == 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } StringPair pair = substringSourceExcluded(source, offset, count); if (pair == null) @@ -204,7 +204,7 @@ source = second; } if (source == null) - source = new String(); // delete all + source = ""; // delete all setTextSource(source); } @@ -226,7 +226,7 @@ */ private String getData(IStructuredDocumentRegion flatNode) { if (flatNode == null) - return new String(); + return ""; if (flatNode instanceof StructuredDocumentRegionContainer) { StructuredDocumentRegionContainer container = (StructuredDocumentRegionContainer) flatNode; @@ -430,16 +430,16 @@ if (arg == null || arg.length() == 0) return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (offset < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String source = getSource(); if (source == null || source.length() == 0) { if (offset > 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } source = getSource(arg); if (source != null) @@ -511,20 +511,20 @@ if (newText == null) return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } TextImpl text = (TextImpl) newText; String newSource = text.getSource(); if (newSource == null || newSource.length() == 0) return; if (offset < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String source = getSource(); if (source == null || source.length() == 0) { if (offset > 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } setTextSource(newSource); return; @@ -737,7 +737,7 @@ */ public void replaceData(int offset, int count, String arg) throws DOMException { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (arg == null || arg.length() == 0) { deleteData(offset, count); @@ -748,12 +748,12 @@ return; } if (offset < 0 || count < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String source = getSource(); if (source == null || source.length() == 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } StringPair pair = substringSourceExcluded(source, offset, count); @@ -852,7 +852,7 @@ */ public void setData(String data) throws DOMException { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.fSource = null; @@ -863,7 +863,7 @@ */ public void setSource(String source) throws InvalidCharacterException { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } SourceValidator validator = new SourceValidator(this); @@ -883,7 +883,7 @@ */ public void setTextSource(String source) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.fSource = source; @@ -895,7 +895,7 @@ */ public void setValueSource(String source) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } SourceValidator validator = new SourceValidator(this); @@ -911,14 +911,14 @@ */ public Text splitText(int offset) throws DOMException { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (offset < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int length = getLength(); if (offset > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } Document document = getOwnerDocument(); if (document == null) @@ -1005,17 +1005,17 @@ private String substringData(String data, int offset, int count) throws DOMException { // sure offset and count are non-negative if (count == 0) - return new String(); + return ""; if (data == null) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int length = data.length(); if (offset > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int end = offset + count; if (end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } return data.substring(offset, end); } @@ -1033,7 +1033,7 @@ if (data != null && data.length() > 0) { data = substringData(data, offset, count); if (data == null) - return new String(); + return ""; String source = getSource(data); if (source != null) return source; @@ -1049,9 +1049,9 @@ private String substringSource(String source, int offset, int count) throws DOMException { // sure offset and count are non-negative if (count == 0) - return new String(); + return ""; if (source == null) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int length = source.length(); @@ -1079,7 +1079,7 @@ } if (offset > length || end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } return source.substring(offset, end); @@ -1094,7 +1094,7 @@ if (source == null) { if (offset == 0 && count == 0) return new StringPair(null, null); - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int length = source.length(); @@ -1122,7 +1122,7 @@ } if (offset > length || end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String first = (offset > 0 ? source.substring(0, offset) : null); Index: src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java,v retrieving revision 1.7 diff -u -r1.7 CharacterDataImpl.java --- src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java 26 Feb 2009 05:52:16 -0000 1.7 +++ src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java 5 Dec 2009 16:46:11 -0000 @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -78,33 +78,33 @@ if (count == 0) return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (count < 0 || offset < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String data = getData(); if (data == null) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int length = data.length(); if (offset > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (offset == 0) { if (count > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (count == length) - data = new String(); + data = ""; else data = data.substring(count); } else { int end = offset + count; if (end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (end == length) data = data.substring(0, offset); @@ -166,17 +166,17 @@ return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (offset < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String data = getData(); if (data == null) { if (offset > 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } data = arg; } else if (offset == 0) { @@ -184,7 +184,7 @@ } else { int length = data.length(); if (offset > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (offset == length) data += arg; @@ -219,7 +219,7 @@ */ public void replaceData(int offset, int count, String arg) throws DOMException { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (arg == null) { @@ -231,16 +231,16 @@ return; } if (offset < 0 || count < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String data = getData(); if (data == null) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } else if (offset == 0) { int length = data.length(); if (count > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (count == length) data = arg; @@ -250,7 +250,7 @@ int length = data.length(); int end = offset + count; if (end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (end == length) data = data.substring(0, offset) + arg; @@ -275,7 +275,7 @@ */ public void setData(String data) throws DOMException { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.data = (data != null ? data.toCharArray() : null); @@ -312,24 +312,24 @@ */ public String substringData(int offset, int count) throws DOMException { if (count == 0) - return new String(); + return ""; if (offset < 0 || count < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } String data = getData(); if (data == null) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int length = data.length(); if (offset == 0 && count == length) return data; if (offset > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int end = offset + count; if (end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); + throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } return data.substring(offset, end); } Index: src/org/eclipse/wst/xml/core/internal/document/CommentImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CommentImpl.java,v retrieving revision 1.9 diff -u -r1.9 CommentImpl.java --- src/org/eclipse/wst/xml/core/internal/document/CommentImpl.java 26 Feb 2009 05:52:16 -0000 1.9 +++ src/org/eclipse/wst/xml/core/internal/document/CommentImpl.java 5 Dec 2009 16:46:11 -0000 @@ -12,7 +12,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -82,7 +82,7 @@ String sdata = getData(getStructuredDocumentRegion()); if (sdata != null) return sdata; - return new String(); + return ""; } return new String(data); } @@ -185,7 +185,7 @@ return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } DocumentImpl document = (DocumentImpl) getOwnerDocument(); Index: src/org/eclipse/wst/xml/core/internal/document/EntityReferenceImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/EntityReferenceImpl.java,v retrieving revision 1.5 diff -u -r1.5 EntityReferenceImpl.java --- src/org/eclipse/wst/xml/core/internal/document/EntityReferenceImpl.java 10 Apr 2007 20:05:34 -0000 1.5 +++ src/org/eclipse/wst/xml/core/internal/document/EntityReferenceImpl.java 5 Dec 2009 16:46:11 -0000 @@ -12,7 +12,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -70,7 +70,7 @@ */ public String getNodeName() { if (this.name == null) - return new String(); + return ""; return this.name; } Index: src/org/eclipse/wst/xml/core/internal/document/NodeContainer.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeContainer.java,v retrieving revision 1.9 diff -u -r1.9 NodeContainer.java --- src/org/eclipse/wst/xml/core/internal/document/NodeContainer.java 12 Aug 2009 15:07:40 -0000 1.9 +++ src/org/eclipse/wst/xml/core/internal/document/NodeContainer.java 5 Dec 2009 16:46:12 -0000 @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -245,16 +245,16 @@ if (newChild == null) return null; // nothing to do if (refChild != null && refChild.getParentNode() != this) { - throw new DOMException(DOMException.NOT_FOUND_ERR, new String()); + throw new DOMException(DOMException.NOT_FOUND_ERR, ""); } if (!isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (newChild == refChild) return newChild; // nothing to do //new child can not be a parent of this, would cause cycle if(isParent(newChild)) { - throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, new String()); + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); } if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) { @@ -372,11 +372,11 @@ if (oldChild == null) return null; if (oldChild.getParentNode() != this) { - throw new DOMException(DOMException.NOT_FOUND_ERR, new String()); + throw new DOMException(DOMException.NOT_FOUND_ERR, ""); } if (!isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } // synchronized in case another thread is getting item, or length @@ -412,7 +412,7 @@ */ public void removeChildNodes() { if (!isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } Node nextChild = null; @@ -435,7 +435,7 @@ if (!hasChildNodes()) return null; if (!isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } Document document = null; @@ -476,7 +476,7 @@ */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { if (!isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (oldChild == null) Index: src/org/eclipse/wst/xml/core/internal/document/EntityImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/EntityImpl.java,v retrieving revision 1.8 diff -u -r1.8 EntityImpl.java --- src/org/eclipse/wst/xml/core/internal/document/EntityImpl.java 10 Apr 2007 20:05:34 -0000 1.8 +++ src/org/eclipse/wst/xml/core/internal/document/EntityImpl.java 5 Dec 2009 16:46:11 -0000 @@ -12,7 +12,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -93,7 +93,7 @@ */ public String getNodeName() { if (this.name == null) - return new String(); + return ""; return this.name; } @@ -182,7 +182,7 @@ */ public void setNotationName(String notationName) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.notationName = notationName; @@ -196,7 +196,7 @@ */ public void setPublicId(String publicId) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.publicId = publicId; @@ -210,7 +210,7 @@ */ public void setSystemId(String systemId) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.systemId = systemId; Index: src/org/eclipse/wst/xml/core/internal/document/DocumentTypeImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DocumentTypeImpl.java,v retrieving revision 1.9 diff -u -r1.9 DocumentTypeImpl.java --- src/org/eclipse/wst/xml/core/internal/document/DocumentTypeImpl.java 10 Apr 2007 20:05:34 -0000 1.9 +++ src/org/eclipse/wst/xml/core/internal/document/DocumentTypeImpl.java 5 Dec 2009 16:46:11 -0000 @@ -12,7 +12,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -93,7 +93,7 @@ */ public String getName() { if (this.name == null) - return new String(); + return ""; return this.name; } @@ -156,7 +156,7 @@ */ public void setInternalSubset(String internalSubset) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.internalSubset = internalSubset; @@ -180,7 +180,7 @@ */ public void setPublicId(String publicId) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.publicId = publicId; @@ -196,7 +196,7 @@ */ public void setSystemId(String systemId) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.systemId = systemId; Index: src/org/eclipse/wst/xml/core/internal/document/ProcessingInstructionImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/ProcessingInstructionImpl.java,v retrieving revision 1.8 diff -u -r1.8 ProcessingInstructionImpl.java --- src/org/eclipse/wst/xml/core/internal/document/ProcessingInstructionImpl.java 10 Apr 2007 20:05:34 -0000 1.8 +++ src/org/eclipse/wst/xml/core/internal/document/ProcessingInstructionImpl.java 5 Dec 2009 16:46:12 -0000 @@ -12,7 +12,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -84,10 +84,10 @@ IStructuredDocumentRegion flatNode = getFirstStructuredDocumentRegion(); if (flatNode == null) - return new String(); + return ""; ITextRegionList regions = flatNode.getRegions(); if (regions == null) - return new String(); + return ""; ITextRegion targetRegion = null; ITextRegion dataRegion = null; @@ -109,7 +109,7 @@ } } if (dataRegion == null) - return new String(); + return ""; int offset = dataRegion.getStart(); int end = flatNode.getLength(); if (closeRegion != null) @@ -152,7 +152,7 @@ */ public String getTarget() { if (this.target == null) - return new String(); + return ""; return this.target; } @@ -181,7 +181,7 @@ */ public void setData(String data) throws DOMException { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.data = data; Index: src/org/eclipse/wst/xml/core/internal/document/AttrImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/AttrImpl.java,v retrieving revision 1.28 diff -u -r1.28 AttrImpl.java --- src/org/eclipse/wst/xml/core/internal/document/AttrImpl.java 20 Oct 2009 20:13:42 -0000 1.28 +++ src/org/eclipse/wst/xml/core/internal/document/AttrImpl.java 5 Dec 2009 16:46:11 -0000 @@ -12,6 +12,8 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 + * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -44,6 +46,8 @@ * AttrImpl class */ public class AttrImpl extends NodeImpl implements IDOMAttr { + private static String EMPTY_STRING = ""; + private ITextRegion equalRegion = null; private char[] fName = null; @@ -151,7 +155,7 @@ */ public String getName() { if (this.fName == null) - return new String(); + return EMPTY_STRING; return new String(this.fName); } @@ -346,7 +350,7 @@ */ private String getValue(String source) { if (source == null) - return new String(); + return EMPTY_STRING; if (source.length() == 0) return source; StringBuffer buffer = null; @@ -440,7 +444,7 @@ return null; if (this.fValueRegion != null) return StructuredDocumentRegionUtil.getAttrValue(ownerRegion, this.fValueRegion); - return new String(); + return EMPTY_STRING; } private String getValueSource(ElementImpl ownerElement) { @@ -453,7 +457,7 @@ // the flatnode that this.valueRegion belongs to. if (this.fValueRegion != null) return StructuredDocumentRegionUtil.getAttrValue(ownerElement.getStructuredDocumentRegion(), this.fValueRegion); - return new String(); + return EMPTY_STRING; } /** @@ -704,7 +708,7 @@ */ public void setPrefix(String prefix) throws DOMException { if (this.ownerElement != null && !this.ownerElement.isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, EMPTY_STRING); } int prefixLength = (prefix != null ? prefix.length() : 0); String localName = getLocalName(); @@ -713,7 +717,7 @@ return; } if (localName == null) - localName = new String(); + localName = EMPTY_STRING; int localLength = localName.length(); StringBuffer buffer = new StringBuffer(prefixLength + 1 + localLength); buffer.append(prefix); @@ -756,7 +760,7 @@ public void setValueSource(String source) { if (this.ownerElement != null && !this.ownerElement.isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, EMPTY_STRING); } this.fValueSource = (source != null) ? source.toCharArray() : null; Index: src/org/eclipse/wst/xml/core/internal/document/ElementImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/ElementImpl.java,v retrieving revision 1.26 diff -u -r1.26 ElementImpl.java --- src/org/eclipse/wst/xml/core/internal/document/ElementImpl.java 23 Nov 2009 20:16:19 -0000 1.26 +++ src/org/eclipse/wst/xml/core/internal/document/ElementImpl.java 5 Dec 2009 16:46:11 -0000 @@ -14,7 +14,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -174,7 +174,7 @@ return null; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (this.attrNodes == null) @@ -241,7 +241,7 @@ // In the absence of the attribute, get the default value if (attr == null) { String defaultValue = getDefaultValue(name); - return (defaultValue != null) ? defaultValue : new String(); + return (defaultValue != null) ? defaultValue : ""; } return attr.getValue(); } @@ -258,7 +258,7 @@ if (attribute instanceof CMAttributeDeclaration) return ((CMAttributeDeclaration) attribute).getAttrType().getImpliedValue(); } - return new String(); + return ""; } /** @@ -327,7 +327,7 @@ // In the absence of the attribute, get the default value if (attr == null) { String defaultValue = getDefaultValue(name); - return (defaultValue != null) ? defaultValue : new String(); + return (defaultValue != null) ? defaultValue : ""; } return attr.getValue(); } @@ -614,7 +614,7 @@ */ public String getTagName() { if (this.fTagName == null) - return new String(); + return ""; return new String(fTagName); } @@ -706,13 +706,13 @@ if (newChild == null) return null; if (!isContainer()) { // never be container - throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, new String()); + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); } if (newChild.getNodeType() != TEXT_NODE) { if (isJSPContainer() || isCDATAContainer()) { // accepts only // Text // child - throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, new String()); + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); } } return super.insertBefore(newChild, refChild); @@ -1017,11 +1017,11 @@ return null; // invalid parameter if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (this.attrNodes == null) { // no attribute - throw new DOMException(DOMException.NOT_FOUND_ERR, new String()); + throw new DOMException(DOMException.NOT_FOUND_ERR, ""); } int length = this.attrNodes.getLength(); @@ -1039,7 +1039,7 @@ } // not found - throw new DOMException(DOMException.NOT_FOUND_ERR, new String()); + throw new DOMException(DOMException.NOT_FOUND_ERR, ""); } /** @@ -1056,7 +1056,7 @@ return null; // no attribute if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } int length = this.attrNodes.getLength(); @@ -1087,7 +1087,7 @@ return null; // no attribute if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } int length = this.attrNodes.getLength(); @@ -1133,7 +1133,7 @@ return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } int length = this.attrNodes.getLength(); @@ -1210,7 +1210,7 @@ return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } Attr attr = getAttributeNode(name); @@ -1242,7 +1242,7 @@ return null; // nothing to do if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } AttrImpl attr = (AttrImpl) newAttr; @@ -1250,7 +1250,7 @@ if (owner != null) { if (owner == this) return null; // nothing to do - throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, new String()); + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, ""); } Attr oldAttr = removeAttributeNode(newAttr.getName()); @@ -1265,7 +1265,7 @@ return null; // nothing to do if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } AttrImpl attr = (AttrImpl) newAttr; @@ -1273,7 +1273,7 @@ if (owner != null) { if (owner == this) return null; // nothing to do - throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, new String()); + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, ""); } String name = newAttr.getLocalName(); @@ -1291,7 +1291,7 @@ return; if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139552 @@ -1322,7 +1322,7 @@ public void setCommentTag(boolean isCommentTag) { IDOMNode parent = (IDOMNode) getParentNode(); if (parent != null && !parent.isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (isCommentTag) @@ -1340,7 +1340,7 @@ public void setEmptyTag(boolean isEmptyTag) { IDOMNode parent = (IDOMNode) getParentNode(); if (parent != null && !parent.isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (isEmptyTag) @@ -1372,7 +1372,7 @@ public void setJSPTag(boolean isJSPTag) { IDOMNode parent = (IDOMNode) getParentNode(); if (parent != null && !parent.isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } if (isJSPTag) @@ -1410,7 +1410,7 @@ public void setPrefix(String prefix) throws DOMException { IDOMNode parent = (IDOMNode) getParentNode(); if (parent != null && !parent.isChildEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } int prefixLength = (prefix != null ? prefix.length() : 0); Index: src/org/eclipse/wst/xml/core/internal/document/CDATASectionImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CDATASectionImpl.java,v retrieving revision 1.8 diff -u -r1.8 CDATASectionImpl.java --- src/org/eclipse/wst/xml/core/internal/document/CDATASectionImpl.java 26 Feb 2009 05:52:16 -0000 1.8 +++ src/org/eclipse/wst/xml/core/internal/document/CDATASectionImpl.java 5 Dec 2009 16:46:11 -0000 @@ -13,6 +13,7 @@ * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -77,7 +78,7 @@ String sdata = getData(getStructuredDocumentRegion()); if (sdata != null) return sdata; - return new String(); + return ""; } return new String(data); } Index: src/org/eclipse/wst/xml/core/internal/document/NotationImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NotationImpl.java,v retrieving revision 1.5 diff -u -r1.5 NotationImpl.java --- src/org/eclipse/wst/xml/core/internal/document/NotationImpl.java 10 Apr 2007 20:05:34 -0000 1.5 +++ src/org/eclipse/wst/xml/core/internal/document/NotationImpl.java 5 Dec 2009 16:46:12 -0000 @@ -12,7 +12,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -75,7 +75,7 @@ */ public String getNodeName() { if (this.name == null) - return new String(); + return ""; return this.name; } @@ -124,7 +124,7 @@ */ public void setPublicId(String publicId) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.publicId = publicId; } @@ -137,7 +137,7 @@ */ public void setSystemId(String systemId) { if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } this.systemId = systemId; } Index: src/org/eclipse/wst/xml/core/internal/document/XMLModelUpdater.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelUpdater.java,v retrieving revision 1.11 diff -u -r1.11 XMLModelUpdater.java --- src/org/eclipse/wst/xml/core/internal/document/XMLModelUpdater.java 19 Aug 2009 21:38:21 -0000 1.11 +++ src/org/eclipse/wst/xml/core/internal/document/XMLModelUpdater.java 5 Dec 2009 16:46:13 -0000 @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -82,7 +82,7 @@ String name = attr.getName(); if (name == null) - name = new String(); + name = ""; ITextRegion nameRegion = attr.getNameRegion(); if (nameRegion == null) return; // error @@ -140,7 +140,7 @@ value = this.generator.generateAttrValue(attr, quote); if (value == null) { - value = new String(); + value = ""; // remove equal too ITextRegion equalRegion = attr.getEqualRegion(); if (equalRegion != null) @@ -160,7 +160,7 @@ if (value == null) { if (equalRegion == null) return; // nothng to do - value = new String(); + value = ""; // remove equal start += equalRegion.getStart(); end += equalRegion.getTextEnd(); @@ -525,7 +525,7 @@ String source = this.generator.generateSource(text); if (source == null) - source = new String(); + source = ""; int length = source.length(); TextImpl impl = (TextImpl) text; @@ -607,7 +607,7 @@ String source = this.generator.generateSource(node); if (source == null) - source = new String(); + source = ""; int length = source.length(); NodeImpl impl = (NodeImpl) node; @@ -1488,7 +1488,7 @@ else { String content = this.generator.generateSource(node); if (content == null) - content = new String(); + content = ""; int length = content.length(); IStructuredDocumentRegion flatNode = null; if (length > 0) { @@ -1590,7 +1590,7 @@ private void replaceSource(String source, int start, int end) { int inserted = 0; if (source == null) - source = new String(); + source = ""; else inserted = source.length(); int removed = end - start; Index: src/org/eclipse/wst/xml/core/internal/document/StructuredDocumentRegionProxy.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/StructuredDocumentRegionProxy.java,v retrieving revision 1.11 diff -u -r1.11 StructuredDocumentRegionProxy.java --- src/org/eclipse/wst/xml/core/internal/document/StructuredDocumentRegionProxy.java 10 Apr 2007 20:05:34 -0000 1.11 +++ src/org/eclipse/wst/xml/core/internal/document/StructuredDocumentRegionProxy.java 5 Dec 2009 16:46:12 -0000 @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -216,10 +216,10 @@ */ public String getText() { if (this.flatNode == null) - return new String(); + return ""; String text = this.flatNode.getText(); if (text == null) - return new String(); + return ""; int end = this.offset + this.length; return text.substring(this.offset, end); } Index: src/org/eclipse/wst/xml/core/internal/document/StructuredDocumentRegionContainer.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/StructuredDocumentRegionContainer.java,v retrieving revision 1.11 diff -u -r1.11 StructuredDocumentRegionContainer.java --- src/org/eclipse/wst/xml/core/internal/document/StructuredDocumentRegionContainer.java 10 Apr 2007 20:05:34 -0000 1.11 +++ src/org/eclipse/wst/xml/core/internal/document/StructuredDocumentRegionContainer.java 5 Dec 2009 16:46:12 -0000 @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -238,7 +238,7 @@ public String getText() { int size = this.flatNodes.size(); if (size == 0) - return new String(); + return ""; StringBuffer buffer = new StringBuffer(); for (int i = 0; i < size; i++) { IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) this.flatNodes.elementAt(i); Index: src/org/eclipse/wst/xml/core/internal/document/DocumentImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/DocumentImpl.java,v retrieving revision 1.29 diff -u -r1.29 DocumentImpl.java --- src/org/eclipse/wst/xml/core/internal/document/DocumentImpl.java 14 Oct 2009 23:29:20 -0000 1.29 +++ src/org/eclipse/wst/xml/core/internal/document/DocumentImpl.java 5 Dec 2009 16:46:11 -0000 @@ -12,7 +12,7 @@ * * Balazs Banfai: Bug 154737 getUserData/setUserData support for Node * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154737 - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -335,7 +335,7 @@ public Element createCommentElement(String tagName, boolean isJSPTag) throws DOMException { Element result = null; if (!isJSPType() && isJSPTag) { - throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, new String()); + throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, ""); } ElementImpl element = (ElementImpl) createElement(tagName); element.setJSPTag(isJSPTag); @@ -344,7 +344,7 @@ result = element; } else { - throw new DOMException(DOMException.INVALID_CHARACTER_ERR, new String()); + throw new DOMException(DOMException.INVALID_CHARACTER_ERR, ""); } return result; } @@ -394,7 +394,7 @@ */ public Element createElementNS(String uri, String tagName) throws DOMException { if (!isValidName(tagName)) { - throw new DOMException(DOMException.INVALID_CHARACTER_ERR, new String()); + throw new DOMException(DOMException.INVALID_CHARACTER_ERR, ""); } ElementImpl element = (ElementImpl) createElement(tagName); @@ -425,7 +425,7 @@ */ public EntityReference createEntityReference(String name) throws DOMException { if (!isXMLType()) { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, new String()); + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } EntityReferenceImpl ref = new EntityReferenceImpl(); Index: src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java,v retrieving revision 1.22 diff -u -r1.22 NodeImpl.java --- src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java 24 Nov 2009 02:57:06 -0000 1.22 +++ src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java 5 Dec 2009 16:46:12 -0000 @@ -15,6 +15,7 @@ * * David Carver (STAR) - bug 295127 - implement isSameNode and compareDocumentPosition methods. * Unit Tests covered in wst.xsl XPath 2.0 tests. + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.document; @@ -96,7 +97,7 @@ * org.w3c.dom.Node */ public Node appendChild(Node newChild) throws DOMException { - throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, new String()); + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); } /** @@ -422,7 +423,7 @@ */ public String getSource() { if (this.flatNode == null) - return new String(); + return ""; return this.flatNode.getText(); } @@ -519,7 +520,7 @@ * org.w3c.dom.Node */ public Node insertBefore(Node newChild, Node refChild) throws DOMException { - throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, new String()); + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); } public boolean isChildEditable() { @@ -575,7 +576,7 @@ break; default : - result = new String(); + result = ""; break; } return result; @@ -646,7 +647,7 @@ * org.w3c.dom.Node */ public Node removeChild(Node oldChild) throws DOMException { - throw new DOMException(DOMException.NOT_FOUND_ERR, new String()); + throw new DOMException(DOMException.NOT_FOUND_ERR, ""); } /** @@ -678,7 +679,7 @@ * org.w3c.dom.Node */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { - throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, new String()); + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); } /** @@ -848,7 +849,7 @@ */ public short compareDocumentPosition(Node other) throws DOMException { if (!(other instanceof IDOMNode)) - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, new String()); + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); int nodeStart = this.getStartOffset(); int otherStart = ((IDOMNode) other).getStartOffset(); Index: src/org/eclipse/wst/xml/core/internal/provisional/format/CommentNodeFormatter.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/provisional/format/CommentNodeFormatter.java,v retrieving revision 1.5 diff -u -r1.5 CommentNodeFormatter.java --- src/org/eclipse/wst/xml/core/internal/provisional/format/CommentNodeFormatter.java 27 Mar 2007 21:37:10 -0000 1.5 +++ src/org/eclipse/wst/xml/core/internal/provisional/format/CommentNodeFormatter.java 5 Dec 2009 16:46:13 -0000 @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.provisional.format; @@ -23,7 +23,7 @@ static private final String LF = "\n"; //$NON-NLS-1$ protected String adjustIndentations(String aString, String lineIndent, String singleIndent) { - String result = new String(); + String result = ""; int indexOfLineDelimiter = StringUtils.indexOfLineDelimiter(aString); result = aString.substring(0, indexOfLineDelimiter); Index: src/org/eclipse/wst/xml/core/internal/provisional/format/ElementNodeFormatter.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/provisional/format/ElementNodeFormatter.java,v retrieving revision 1.10 diff -u -r1.10 ElementNodeFormatter.java --- src/org/eclipse/wst/xml/core/internal/provisional/format/ElementNodeFormatter.java 20 Feb 2008 19:00:28 -0000 1.10 +++ src/org/eclipse/wst/xml/core/internal/provisional/format/ElementNodeFormatter.java 5 Dec 2009 16:46:13 -0000 @@ -9,7 +9,7 @@ * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring * Jesper Steen M�ller - xml:space='preserve' support - * + * David Carver (STAR) - bug 296999 - Inefficient use of new String() *******************************************************************************/ package org.eclipse.wst.xml.core.internal.provisional.format; @@ -404,7 +404,7 @@ } protected String getUndefinedRegions(IDOMNode node, int startOffset, int length) { - String result = new String(); + String result = ""; IStructuredDocumentRegion flatNode = node.getFirstStructuredDocumentRegion(); ITextRegionList regions = flatNode.getRegions();