Author: hboutemy Date: Wed Oct 31 08:41:13 2012 New Revision: 1404034 URL: http://svn.apache.org/viewvc?rev=1404034&view=rev Log: code formatting
Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XMLEncode.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomWriter.java Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java?rev=1404034&r1=1404033&r2=1404034&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java Wed Oct 31 08:41:13 2012 @@ -26,7 +26,7 @@ import java.util.LinkedList; import org.apache.maven.shared.utils.Os; /** - * XMLWriter with nice indention + * XMLWriter with nice indentation */ public class PrettyPrintXMLWriter implements XMLWriter Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XMLEncode.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XMLEncode.java?rev=1404034&r1=1404033&r2=1404034&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XMLEncode.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XMLEncode.java Wed Oct 31 08:41:13 2012 @@ -19,7 +19,6 @@ package org.apache.maven.shared.utils.xm * under the License. */ - /** * Collection of XML encoding/decoding helpers. <br> * This is all about the special characters & and <, and for attributes @@ -37,10 +36,11 @@ final class XMLEncode */ public static boolean isWhiteSpace( String text ) { - for( int i = 0; i < text.length(); i++ ) + for ( int i = 0; i < text.length(); i++ ) { char c = text.charAt( i ); - if (!Character.isWhitespace( c )) { + if ( !Character.isWhitespace( c ) ) + { return false; } } @@ -52,7 +52,7 @@ final class XMLEncode */ public static String xmlEncodeTextForAttribute( String text, char quoteChar ) { - if( text == null ) + if ( text == null ) { return null; } @@ -64,21 +64,21 @@ final class XMLEncode */ public static String xmlEncodeText( String text ) { - if( text == null ) + if ( text == null ) { return null; } - if( !needsEncoding( text ) ) + if ( !needsEncoding( text ) ) { return text; } else { // only encode as cdata if is is longer than CDATA block overhead: - if( text.length() > CDATA_BLOCK_THRESHOLD_LENGTH ) + if ( text.length() > CDATA_BLOCK_THRESHOLD_LENGTH ) { String cdata = xmlEncodeTextAsCDATABlock( text ); - if( cdata != null ) + if ( cdata != null ) { return cdata; } @@ -93,7 +93,7 @@ final class XMLEncode */ public static String xmlEncodeTextAsPCDATA( String text ) { - if( text == null ) + if ( text == null ) { return null; } @@ -120,16 +120,16 @@ final class XMLEncode */ public static String xmlEncodeTextAsPCDATA( String text, boolean forAttribute, char quoteChar ) { - if( text == null ) + if ( text == null ) { return null; } char c; StringBuilder n = new StringBuilder( text.length() * 2 ); - for( int i = 0; i < text.length(); i++ ) + for ( int i = 0; i < text.length(); i++ ) { c = text.charAt( i ); - switch( c ) + switch ( c ) { case '&': n.append( "&" ); @@ -141,7 +141,7 @@ final class XMLEncode n.append( ">" ); break; case '"': - if( forAttribute ) + if ( forAttribute ) { n.append( """ ); } @@ -151,7 +151,7 @@ final class XMLEncode } break; case '\'': - if( forAttribute ) + if ( forAttribute ) { n.append( "'" ); } @@ -163,7 +163,7 @@ final class XMLEncode case '\r': if ( forAttribute ) { - if ( i == text.length() || text.charAt( i + 1 ) != '\n') + if ( i == text.length() || text.charAt( i + 1 ) != '\n' ) { n.append( " " ); } @@ -191,7 +191,7 @@ final class XMLEncode } } - if( forAttribute ) + if ( forAttribute ) { n.append( quoteChar ); n.insert( 0, quoteChar ); @@ -205,11 +205,11 @@ final class XMLEncode */ public static String xmlEncodeTextAsCDATABlock( String text ) { - if( text == null ) + if ( text == null ) { return null; } - if( isCompatibleWithCDATABlock( text ) ) + if ( isCompatibleWithCDATABlock( text ) ) { return "<![CDATA[" + text + "]]>"; } @@ -235,15 +235,15 @@ final class XMLEncode */ public static boolean needsEncoding( String data, boolean checkForAttr ) { - if( data == null ) + if ( data == null ) { return false; } char c; - for( int i = 0; i < data.length(); i++ ) + for ( int i = 0; i < data.length(); i++ ) { c = data.charAt( i ); - if( c == '&' || c == '<' || (checkForAttr && (c == '"' || c == '\'')) ) + if ( c == '&' || c == '<' || ( checkForAttr && ( c == '"' || c == '\'' ) ) ) { return true; } @@ -256,7 +256,7 @@ final class XMLEncode */ public static boolean isCompatibleWithCDATABlock( String text ) { - return text != null && (!text.contains("]]>")); + return text != null && ( !text.contains( "]]>" ) ); } /** @@ -265,16 +265,16 @@ final class XMLEncode */ public static String xmlDecodeTextToCDATA( String pcdata ) { - if( pcdata == null ) + if ( pcdata == null ) { return null; } char c, c1, c2, c3, c4, c5; StringBuilder n = new StringBuilder( pcdata.length() ); - for( int i = 0; i < pcdata.length(); i++ ) + for ( int i = 0; i < pcdata.length(); i++ ) { c = pcdata.charAt( i ); - if( c == '&' ) + if ( c == '&' ) { c1 = lookAhead( 1, i, pcdata ); c2 = lookAhead( 2, i, pcdata ); @@ -282,27 +282,27 @@ final class XMLEncode c4 = lookAhead( 4, i, pcdata ); c5 = lookAhead( 5, i, pcdata ); - if( c1 == 'a' && c2 == 'm' && c3 == 'p' && c4 == ';' ) + if ( c1 == 'a' && c2 == 'm' && c3 == 'p' && c4 == ';' ) { n.append( "&" ); i += 4; } - else if( c1 == 'l' && c2 == 't' && c3 == ';' ) + else if ( c1 == 'l' && c2 == 't' && c3 == ';' ) { n.append( "<" ); i += 3; } - else if( c1 == 'g' && c2 == 't' && c3 == ';' ) + else if ( c1 == 'g' && c2 == 't' && c3 == ';' ) { n.append( ">" ); i += 3; } - else if( c1 == 'q' && c2 == 'u' && c3 == 'o' && c4 == 't' && c5 == ';' ) + else if ( c1 == 'q' && c2 == 'u' && c3 == 'o' && c4 == 't' && c5 == ';' ) { n.append( "\"" ); i += 5; } - else if( c1 == 'a' && c2 == 'p' && c3 == 'o' && c4 == 's' && c5 == ';' ) + else if ( c1 == 'a' && c2 == 'p' && c3 == 'o' && c4 == 's' && c5 == ';' ) { n.append( "'" ); i += 5; @@ -326,7 +326,7 @@ final class XMLEncode { return data.charAt( offset + la ); } - catch( StringIndexOutOfBoundsException e ) + catch ( StringIndexOutOfBoundsException e ) { return 0x0; } @@ -335,15 +335,17 @@ final class XMLEncode // combine multiple checks in one methods for speed private static boolean contains( String text, char[] chars ) { - if( text == null || chars == null || chars.length == 0 ) + if ( text == null || chars == null || chars.length == 0 ) { return false; } - for( int i = 0; i < text.length(); i++ ) + for ( int i = 0; i < text.length(); i++ ) { char c = text.charAt( i ); - for (char aChar : chars) { - if (aChar == c) { + for ( char aChar : chars ) + { + if ( aChar == c ) + { return true; } } Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java?rev=1404034&r1=1404033&r2=1404034&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java Wed Oct 31 08:41:13 2012 @@ -34,7 +34,9 @@ import javax.annotation.Nonnull; * * @author Kristian Rosenvold */ -public class Xpp3Dom implements Iterable<Xpp3Dom> { +public class Xpp3Dom + implements Iterable<Xpp3Dom> +{ @SuppressWarnings( "UnusedDeclaration" ) private static final long serialVersionUID = 2567894443061173996L; @@ -80,7 +82,7 @@ public class Xpp3Dom implements Iterable public Xpp3Dom( Xpp3Dom source) { - this(source, source.getName() ); + this( source, source.getName() ); } public Xpp3Dom( @Nonnull Xpp3Dom src, String name ) @@ -89,16 +91,18 @@ public class Xpp3Dom implements Iterable int size = src.getChildCount(); childList = new ArrayList<Xpp3Dom>( size ); - childMap = new HashMap<String, Xpp3Dom>( ); + childMap = new HashMap<String, Xpp3Dom>(); setValue( src.getValue() ); - for (String attributeName : src.getAttributeNames()) { - setAttribute(attributeName, src.getAttribute(attributeName)); + for ( String attributeName : src.getAttributeNames() ) + { + setAttribute( attributeName, src.getAttribute( attributeName ) ); } - for (Xpp3Dom xpp3Dom : src.getChildren()) { - addChild( new Xpp3Dom( xpp3Dom )); + for ( Xpp3Dom xpp3Dom : src.getChildren() ) + { + addChild( new Xpp3Dom( xpp3Dom ) ); } } @@ -133,13 +137,15 @@ public class Xpp3Dom implements Iterable @SuppressWarnings( "ConstantConditions" ) public void setAttribute( @Nonnull String name, @Nonnull String value ) { - if ( value == null) { + if ( value == null ) + { throw new NullPointerException( "value can not be null" ); } - if ( name == null) { + if ( name == null ) + { throw new NullPointerException( "name can not be null" ); } - if ( attributes == null) + if ( attributes == null ) { attributes = new HashMap<String, String>(); } @@ -178,22 +184,24 @@ public class Xpp3Dom implements Iterable public Xpp3Dom[] getChildren( String name ) { - List<Xpp3Dom> children = getChildrenList(name); - return children.toArray(new Xpp3Dom[children.size()]); + List<Xpp3Dom> children = getChildrenList( name ); + return children.toArray( new Xpp3Dom[children.size()] ); } private List<Xpp3Dom> getChildrenList( String name ) { - if ( childList== null ) + if ( childList == null ) { return Collections.emptyList(); } else { ArrayList<Xpp3Dom> children = new ArrayList<Xpp3Dom>(); - for (Xpp3Dom aChildList : childList) { - if (name.equals(aChildList.getName())) { - children.add(aChildList); + for ( Xpp3Dom aChildList : childList ) + { + if ( name.equals( aChildList.getName() ) ) + { + children.add( aChildList ); } } return children; @@ -231,30 +239,35 @@ public class Xpp3Dom implements Iterable // public void writeToSerializer( String namespace, XmlSerializer serializer ) // throws IOException - private static Xpp3Dom merge(Xpp3Dom dominant, Xpp3Dom recessive, Boolean childMergeOverride) + private static Xpp3Dom merge( Xpp3Dom dominant, Xpp3Dom recessive, Boolean childMergeOverride ) { - if ( recessive == null || isCombineSelfOverride(dominant)) + if ( recessive == null || isCombineSelfOverride( dominant ) ) { return dominant; } - if (isEmpty(dominant.getValue())) { - dominant.setValue(recessive.getValue()); + if ( isEmpty( dominant.getValue() ) ) + { + dominant.setValue( recessive.getValue() ); } - for (String attr : recessive.getAttributeNames()) { - if (isEmpty(dominant.getAttribute(attr))) { - dominant.setAttribute(attr, recessive.getAttribute(attr)); + for ( String attr : recessive.getAttributeNames() ) + { + if ( isEmpty( dominant.getAttribute( attr ) ) ) + { + dominant.setAttribute( attr, recessive.getAttribute( attr ) ); } } if ( recessive.getChildCount() > 0 ) { - boolean mergeChildren = isMergeChildren(dominant, childMergeOverride); + boolean mergeChildren = isMergeChildren( dominant, childMergeOverride ); - if (mergeChildren) { - Map<String, Iterator<Xpp3Dom>> commonChildren = getCommonChildren(dominant, recessive); - for (Xpp3Dom recessiveChild : recessive) { + if ( mergeChildren ) + { + Map<String, Iterator<Xpp3Dom>> commonChildren = getCommonChildren( dominant, recessive ); + for ( Xpp3Dom recessiveChild : recessive ) + { Iterator<Xpp3Dom> it = commonChildren.get( recessiveChild.getName() ); if ( it == null ) { @@ -263,59 +276,67 @@ public class Xpp3Dom implements Iterable else if ( it.hasNext() ) { Xpp3Dom dominantChild = it.next(); - merge(dominantChild, recessiveChild, childMergeOverride); + merge( dominantChild, recessiveChild, childMergeOverride ); } } - } else { + } + else + { Xpp3Dom[] dominantChildren = dominant.getChildren(); dominant.childList.clear(); - for (Xpp3Dom child: recessive) { + for ( Xpp3Dom child : recessive ) + { dominant.addChild( new Xpp3Dom( child ) ); } - for (Xpp3Dom aDominantChildren : dominantChildren) { - dominant.addChild(aDominantChildren); + for ( Xpp3Dom aDominantChildren : dominantChildren ) + { + dominant.addChild( aDominantChildren ); } } } return dominant; } - private static Map<String, Iterator<Xpp3Dom>> getCommonChildren(Xpp3Dom dominant, Xpp3Dom recessive) { + private static Map<String, Iterator<Xpp3Dom>> getCommonChildren( Xpp3Dom dominant, Xpp3Dom recessive ) + { Map<String, Iterator<Xpp3Dom>> commonChildren = new HashMap<String, Iterator<Xpp3Dom>>(); for ( String childName : recessive.childMap.keySet() ) { - List<Xpp3Dom> dominantChildren = dominant.getChildrenList(childName); + List<Xpp3Dom> dominantChildren = dominant.getChildrenList( childName ); if ( dominantChildren.size() > 0 ) { - commonChildren.put(childName, dominantChildren.iterator()); + commonChildren.put( childName, dominantChildren.iterator() ); } } return commonChildren; } - private static boolean isMergeChildren(Xpp3Dom dominant, Boolean override) { - return override != null ? override : !isMergeChildren(dominant); + private static boolean isMergeChildren( Xpp3Dom dominant, Boolean override ) + { + return override != null ? override : !isMergeChildren( dominant ); } - private static boolean isMergeChildren(Xpp3Dom dominant) { - return CHILDREN_COMBINATION_APPEND.equals(dominant.getAttribute( CHILDREN_COMBINATION_MODE_ATTRIBUTE )); + private static boolean isMergeChildren( Xpp3Dom dominant ) + { + return CHILDREN_COMBINATION_APPEND.equals( dominant.getAttribute( CHILDREN_COMBINATION_MODE_ATTRIBUTE ) ); } - private static boolean isCombineSelfOverride(Xpp3Dom xpp3Dom){ + private static boolean isCombineSelfOverride( Xpp3Dom xpp3Dom ) + { String selfMergeMode = xpp3Dom.getAttribute( SELF_COMBINATION_MODE_ATTRIBUTE ); return SELF_COMBINATION_OVERRIDE.equals( selfMergeMode ); } public static Xpp3Dom mergeXpp3Dom( Xpp3Dom dominant, Xpp3Dom recessive, Boolean childMergeOverride ) { - return dominant != null ? merge(dominant, recessive, childMergeOverride) : recessive; + return dominant != null ? merge( dominant, recessive, childMergeOverride ) : recessive; } public static Xpp3Dom mergeXpp3Dom( Xpp3Dom dominant, Xpp3Dom recessive ) { - return dominant != null ? merge(dominant, recessive, null) : recessive; + return dominant != null ? merge( dominant, recessive, null ) : recessive; } public boolean equals( Object obj ) @@ -332,10 +353,10 @@ public class Xpp3Dom implements Iterable Xpp3Dom dom = (Xpp3Dom) obj; - return !(name == null ? dom.name != null : !name.equals(dom.name)) && - !(value == null ? dom.value != null : !value.equals(dom.value)) && - !(attributes == null ? dom.attributes != null : !attributes.equals(dom.attributes)) && - !(childList == null ? dom.childList != null : !childList.equals(dom.childList)); + return !( name == null ? dom.name != null : !name.equals( dom.name ) ) + && !( value == null ? dom.value != null : !value.equals( dom.value ) ) + && !( attributes == null ? dom.attributes != null : !attributes.equals( dom.attributes ) ) + && !( childList == null ? dom.childList != null : !childList.equals( dom.childList ) ); } public int hashCode() @@ -351,7 +372,7 @@ public class Xpp3Dom implements Iterable public String toString() { StringWriter writer = new StringWriter(); - Xpp3DomWriter.write(getPrettyPrintXMLWriter(writer), this ); + Xpp3DomWriter.write( getPrettyPrintXMLWriter( writer ), this ); return writer.toString(); } @@ -359,11 +380,12 @@ public class Xpp3Dom implements Iterable public String toUnescapedString() { StringWriter writer = new StringWriter(); - Xpp3DomWriter.write(getPrettyPrintXMLWriter(writer), this, false ); + Xpp3DomWriter.write( getPrettyPrintXMLWriter( writer ), this, false ); return writer.toString(); } - private PrettyPrintXMLWriter getPrettyPrintXMLWriter(StringWriter writer) { + private PrettyPrintXMLWriter getPrettyPrintXMLWriter( StringWriter writer ) + { return new PrettyPrintXMLWriter( writer, "UTF-8", null ); } Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java?rev=1404034&r1=1404033&r2=1404034&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java Wed Oct 31 08:41:13 2012 @@ -53,11 +53,14 @@ public class Xpp3DomBuilder public static Xpp3Dom build( @WillClose InputStream is, @Nonnull String encoding, boolean trim ) throws XmlPullParserException { - try { - Reader reader = new InputStreamReader(is, encoding); - return build( reader, trim); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); + try + { + Reader reader = new InputStreamReader( is, encoding ); + return build( reader, trim ); + } + catch ( UnsupportedEncodingException e ) + { + throw new RuntimeException( e ); } } @@ -66,7 +69,7 @@ public class Xpp3DomBuilder { try { - DocHandler docHandler = parseSax(new InputSource(reader), trim); + DocHandler docHandler = parseSax( new InputSource( reader ), trim ); return docHandler.result; } finally @@ -75,24 +78,34 @@ public class Xpp3DomBuilder } } - private static DocHandler parseSax(@Nonnull InputSource inputSource, boolean trim) throws XmlPullParserException { + private static DocHandler parseSax( @Nonnull + InputSource inputSource, boolean trim ) + throws XmlPullParserException + { - try { - DocHandler ch = new DocHandler(trim); + try + { + DocHandler ch = new DocHandler( trim ); XMLReader parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); - parser.setContentHandler( ch); - parser.parse(inputSource); + parser.setContentHandler( ch ); + parser.parse( inputSource ); return ch; - } catch (IOException e){ - throw new XmlPullParserException(e); - } catch (SAXException e) { - throw new XmlPullParserException(e); + } + catch ( IOException e ) + { + throw new XmlPullParserException( e ); + } + catch ( SAXException e ) + { + throw new XmlPullParserException( e ); } } - - private static class DocHandler extends DefaultHandler { + private static class DocHandler + extends DefaultHandler + { private final List<Xpp3Dom> elemStack = new ArrayList<Xpp3Dom>(); + private final List<StringBuilder> values = new ArrayList<StringBuilder>(); // Todo: Use these for something smart ! @@ -105,17 +118,20 @@ public class Xpp3DomBuilder private final boolean trim; - DocHandler(boolean trim) { + DocHandler( boolean trim ) + { this.trim = trim; } @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + public void startElement( String uri, String localName, String qName, Attributes attributes ) + throws SAXException + { Xpp3Dom child = new Xpp3Dom( localName ); - attachToParent(child); - pushOnStack(child); + attachToParent( child ); + pushOnStack( child ); // Todo: Detecting tags that close immediately seem to be impossible in sax ? // http://stackoverflow.com/questions/12968390/detecting-self-closing-tags-in-sax @@ -124,38 +140,45 @@ public class Xpp3DomBuilder int size = attributes.getLength(); for ( int i = 0; i < size; i++ ) { - child.setAttribute(attributes.getQName(i), attributes.getValue(i)); + child.setAttribute( attributes.getQName( i ), attributes.getValue( i ) ); } } - private boolean pushOnStack(Xpp3Dom child) { - return elemStack.add(child); + private boolean pushOnStack( Xpp3Dom child ) + { + return elemStack.add( child ); } - private void attachToParent(Xpp3Dom child) { + private void attachToParent( Xpp3Dom child ) + { int depth = elemStack.size(); if ( depth > 0 ) { - elemStack.get(depth - 1).addChild(child); + elemStack.get( depth - 1 ).addChild( child ); } } @Override - public void warning(SAXParseException e) throws SAXException { - warnings.add(e); + public void warning( SAXParseException e ) + throws SAXException + { + warnings.add( e ); } @Override - public void error(SAXParseException e) throws SAXException { - errors.add(e); + public void error( SAXParseException e ) + throws SAXException + { + errors.add( e ); } @Override - public void fatalError(SAXParseException e) throws SAXException { - fatals.add(e); + public void fatalError( SAXParseException e ) + throws SAXException + { + fatals.add( e ); } - private Xpp3Dom pop() { int depth = elemStack.size() - 1; @@ -163,12 +186,14 @@ public class Xpp3DomBuilder } @Override - public void endElement(String uri, String localName, String qName) throws SAXException { + public void endElement( String uri, String localName, String qName ) + throws SAXException + { int depth = elemStack.size() - 1; Xpp3Dom finishedConfiguration = pop(); - /* this Object could be null if it is a singleton tag */ + /* this Object could be null if it is a singleton tag */ Object accumulatedValue = values.remove( depth ); if ( finishedConfiguration.getChildCount() == 0 ) @@ -190,15 +215,18 @@ public class Xpp3DomBuilder } @Override - public void characters(char[] ch, int start, int length) throws SAXException { - String text = new String(ch, start, length); - appendToTopValue(trim ? text.trim() : text); + public void characters( char[] ch, int start, int length ) + throws SAXException + { + String text = new String( ch, start, length ); + appendToTopValue( trim ? text.trim() : text ); } - private void appendToTopValue(String toAppend) { - //noinspection MismatchedQueryAndUpdateOfStringBuilder - StringBuilder stringBuilder = values.get(values.size() - 1); - stringBuilder.append( toAppend); + private void appendToTopValue( String toAppend ) + { + // noinspection MismatchedQueryAndUpdateOfStringBuilder + StringBuilder stringBuilder = values.get( values.size() - 1 ); + stringBuilder.append( toAppend ); } } Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomWriter.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomWriter.java?rev=1404034&r1=1404033&r2=1404034&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomWriter.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomWriter.java Wed Oct 31 08:41:13 2012 @@ -46,12 +46,14 @@ public class Xpp3DomWriter { xmlWriter.startElement( dom.getName() ); String[] attributeNames = dom.getAttributeNames(); - for (String attributeName : attributeNames) { - xmlWriter.addAttribute(attributeName, dom.getAttribute(attributeName)); + for ( String attributeName : attributeNames ) + { + xmlWriter.addAttribute( attributeName, dom.getAttribute( attributeName ) ); } Xpp3Dom[] children = dom.getChildren(); - for (Xpp3Dom aChildren : children) { - write(xmlWriter, aChildren, escape); + for ( Xpp3Dom aChildren : children ) + { + write( xmlWriter, aChildren, escape ); } String value = dom.getValue(); @@ -69,5 +71,4 @@ public class Xpp3DomWriter xmlWriter.endElement(); } - }