1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java Wed Sep 24 11:38:20 2014 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java Wed Oct 01 19:30:37 2014 +0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -25,10 +25,6 @@ 1.11 1.12 package com.sun.xml.internal.bind.v2.runtime; 1.13 1.14 -import java.io.IOException; 1.15 - 1.16 -import javax.xml.stream.XMLStreamException; 1.17 - 1.18 import com.sun.istack.internal.FinalArrayList; 1.19 import com.sun.istack.internal.SAXException2; 1.20 1.21 @@ -36,6 +32,9 @@ 1.22 import org.xml.sax.SAXException; 1.23 import org.xml.sax.helpers.DefaultHandler; 1.24 1.25 +import javax.xml.stream.XMLStreamException; 1.26 +import java.io.IOException; 1.27 + 1.28 /** 1.29 * Receives SAX2 events and send the equivalent events to 1.30 * {@link XMLSerializer} 1.31 @@ -70,14 +69,14 @@ 1.32 private boolean containsPrefixMapping(String prefix, String uri) { 1.33 for( int i=0; i<prefixMap.size(); i+=2 ) { 1.34 if(prefixMap.get(i).equals(prefix) 1.35 - && prefixMap.get(i+1).equals(uri)) 1.36 + && prefixMap.get(i+1).equals(uri)) 1.37 return true; 1.38 } 1.39 return false; 1.40 } 1.41 1.42 public void startElement(String namespaceURI, String localName, String qName, Attributes atts) 1.43 - throws SAXException { 1.44 + throws SAXException { 1.45 try { 1.46 flushText(); 1.47 1.48 @@ -92,13 +91,13 @@ 1.49 serializer.startElement(namespaceURI,localName, p,null); 1.50 1.51 // declare namespace events 1.52 - for( int i=0; i<prefixMap.size(); i+=2 ) { 1.53 + for (int i = 0; i < prefixMap.size(); i += 2) { 1.54 // forcibly set this binding, instead of using declareNsUri. 1.55 // this guarantees that namespaces used in DOM will show up 1.56 // as-is in the marshalled output (instead of reassigned to something else, 1.57 // which may happen if you'd use declareNsUri.) 1.58 serializer.getNamespaceContext().force( 1.59 - prefixMap.get(i+1), prefixMap.get(i) ); 1.60 + prefixMap.get(i + 1), prefixMap.get(i)); 1.61 } 1.62 // make sure namespaces needed by attributes are bound 1.63 for( int i=0; i<len; i++ ) { 1.64 @@ -108,7 +107,7 @@ 1.65 String prefix = getPrefix(qname); 1.66 1.67 serializer.getNamespaceContext().declareNamespace( 1.68 - atts.getURI(i), prefix, true ); 1.69 + atts.getURI(i), prefix, true ); 1.70 } 1.71 1.72 serializer.endNamespaceDecls(null); 1.73 @@ -128,9 +127,10 @@ 1.74 } 1.75 } 1.76 1.77 + // make sure namespaces needed by attributes are bound 1.78 private String getPrefix(String qname) { 1.79 int idx = qname.indexOf(':'); 1.80 - String prefix = (idx==-1)?qname:qname.substring(0,idx); 1.81 + String prefix = (idx == -1) ? "" : qname.substring(0, idx); 1.82 return prefix; 1.83 } 1.84