That might indeed be interesting.

Andreas

On Sat, Oct 9, 2010 at 18:53, Senaka Fernando <sen...@apache.org> wrote:
> Andreas,
>
> If we run FindBugs on Axiom, it should suggest many such bugs that we could
> fix. What do you think?
>
> Thanks,
> Senaka.
>
> On Sat, Oct 9, 2010 at 10:11 PM, <veit...@apache.org> wrote:
>
>> Author: veithen
>> Date: Sat Oct  9 16:41:54 2010
>> New Revision: 1006184
>>
>> URL: http://svn.apache.org/viewvc?rev=1006184&view=rev
>> Log:
>> WSCOMMONS-556: Reverted the part of the change in r1002759 that replaced
>> simple String concatenation (using the "+" operator) by direct usage of
>> StringBuilder. In terms of number of String objects created, using
>> StringBuilder in these cases doesn't make any difference because the
>> compiler would generate the same code.
>>
>> Modified:
>>
>>  webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
>>
>>  webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
>>
>> Modified:
>> webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
>> URL:
>> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1006184&r1=1006183&r2=1006184&view=diff
>>
>> ==============================================================================
>> ---
>> webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
>> (original)
>> +++
>> webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
>> Sat Oct  9 16:41:54 2010
>> @@ -61,8 +61,6 @@ public class AttrImpl extends NodeImpl i
>>     /** Flag used to mark an attribute as per the DOM Level 3 specification
>> */
>>     protected boolean isId;
>>
>> -    private String prefixSeparater = ":";
>> -
>>     protected AttrImpl(DocumentImpl ownerDocument, OMFactory factory) {
>>         super(ownerDocument, factory);
>>     }
>> @@ -109,20 +107,11 @@ public class AttrImpl extends NodeImpl i
>>
>>     /** Returns the name of this attribute. */
>>     public String getNodeName() {
>> -        //String prefix = this.namespace.getPrefix();
>> -        if (this.namespace != null
>> +        return (this.namespace != null
>>                 && !"".equals(this.namespace.getPrefix()) &&
>>                 !(OMConstants.XMLNS_NS_PREFIX.equals(this.attrName)))
>> -        {
>> -
>> -            return new
>> StringBuilder(20).append(this.namespace.getPrefix())
>> -                    .append(prefixSeparater)
>> -                    .append(this.attrName).toString();
>> -
>> -        } else {
>> -            return this.attrName;
>> -        }
>> -
>> +                ? this.namespace.getPrefix() + ":" + this.attrName
>> +                : this.attrName;
>>     }
>>
>>     /**
>> @@ -160,20 +149,11 @@ public class AttrImpl extends NodeImpl i
>>             if ((OMConstants.XMLNS_NS_PREFIX.equals(this.attrName))) {
>>                 return this.attrName;
>>             } else if
>> (OMConstants.XMLNS_NS_URI.equals(this.namespace.getNamespaceURI())) {
>> -
>> -                return new StringBuilder(20)
>> -                        .append(OMConstants.XMLNS_NS_PREFIX)
>> -                        .append(prefixSeparater)
>> -                        .append(this.attrName).toString();
>> +                return OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName;
>>             } else if (this.namespace.getPrefix().equals("")) {
>>                 return this.attrName;
>>             } else {
>> -
>> -                return new StringBuilder(20)
>> -                        .append(this.namespace.getPrefix())
>> -                        .append(prefixSeparater)
>> -                        .append(this.attrName).toString();
>> -
>> +                return this.namespace.getPrefix() + ":" + this.attrName;
>>             }
>>         } else {
>>             return this.attrName;
>>
>> Modified:
>> webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
>> URL:
>> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1006184&r1=1006183&r2=1006184&view=diff
>>
>> ==============================================================================
>> ---
>> webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
>> (original)
>> +++
>> webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
>> Sat Oct  9 16:41:54 2010
>> @@ -73,8 +73,6 @@ public class ElementImpl extends ParentN
>>
>>     private static final EmptyIterator EMPTY_ITERATOR = new
>> EmptyIterator();
>>
>> -    private String prefixSeparater = ":";
>> -
>>     private static final String INVALID_CHARACTER_ERR =
>> "INVALID_CHARACTER_ERR";
>>     private static final String NO_MODIFICATION_ALLOWED_ERR =
>> "NO_MODIFICATION_ALLOWED_ERR";
>>     private static final String NAMESPACE_ERR = "NAMESPACE_ERR";
>> @@ -181,10 +179,8 @@ public class ElementImpl extends ParentN
>>             if (this.namespace.getPrefix() == null
>>                     || "".equals(this.namespace.getPrefix())) {
>>                 return this.localName;
>> -            } else {
>> -                return new
>> StringBuilder(20).append(this.namespace.getPrefix())
>> -                        .append(prefixSeparater)
>> -                        .append(this.localName).toString();
>> +            } else {
>> +                return this.namespace.getPrefix() + ":" + this.localName;
>>             }
>>         } else {
>>             return this.localName;
>>
>>
>>
>

Reply via email to