changeset 540:77a45995dd3b jdk9-b33

Merge
author lana
date Thu, 25 Sep 2014 16:20:12 -0700
parents 2c42a24c7d8c ad01ed3c9ac2
children 28ea43d925f1
files
diffstat 2 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java	Thu Sep 25 12:40:24 2014 -0700
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java	Thu Sep 25 16:20:12 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,6 @@
 
 package com.sun.xml.internal.bind.v2.runtime;
 
-import java.io.IOException;
-
-import javax.xml.stream.XMLStreamException;
-
 import com.sun.istack.internal.FinalArrayList;
 import com.sun.istack.internal.SAXException2;
 
@@ -36,6 +32,9 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
+import javax.xml.stream.XMLStreamException;
+import java.io.IOException;
+
 /**
  * Receives SAX2 events and send the equivalent events to
  * {@link XMLSerializer}
@@ -70,14 +69,14 @@
     private boolean containsPrefixMapping(String prefix, String uri) {
         for( int i=0; i<prefixMap.size(); i+=2 ) {
             if(prefixMap.get(i).equals(prefix)
-            && prefixMap.get(i+1).equals(uri))
+                    && prefixMap.get(i+1).equals(uri))
                 return true;
         }
         return false;
     }
 
     public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
-        throws SAXException {
+            throws SAXException {
         try {
             flushText();
 
@@ -92,13 +91,13 @@
                 serializer.startElement(namespaceURI,localName, p,null);
 
             // declare namespace events
-            for( int i=0; i<prefixMap.size(); i+=2 ) {
+            for (int i = 0; i < prefixMap.size(); i += 2) {
                 // forcibly set this binding, instead of using declareNsUri.
                 // this guarantees that namespaces used in DOM will show up
                 // as-is in the marshalled output (instead of reassigned to something else,
                 // which may happen if you'd use declareNsUri.)
                 serializer.getNamespaceContext().force(
-                    prefixMap.get(i+1), prefixMap.get(i) );
+                        prefixMap.get(i + 1), prefixMap.get(i));
             }
             // make sure namespaces needed by attributes are bound
             for( int i=0; i<len; i++ ) {
@@ -108,7 +107,7 @@
                 String prefix = getPrefix(qname);
 
                 serializer.getNamespaceContext().declareNamespace(
-                    atts.getURI(i), prefix, true );
+                        atts.getURI(i), prefix, true );
             }
 
             serializer.endNamespaceDecls(null);
@@ -128,9 +127,10 @@
         }
     }
 
+    // make sure namespaces needed by attributes are bound
     private String getPrefix(String qname) {
         int idx = qname.indexOf(':');
-        String prefix = (idx==-1)?qname:qname.substring(0,idx);
+        String prefix = (idx == -1) ? "" : qname.substring(0, idx);
         return prefix;
     }
 
--- a/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java	Thu Sep 25 12:40:24 2014 -0700
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java	Thu Sep 25 16:20:12 2014 -0700
@@ -70,7 +70,7 @@
         // Quick hack until SJSXP fixes 6270116
         boolean isZephyr = readerClass.getName().equals("com.sun.xml.internal.stream.XMLReaderImpl");
         if (getBoolProp(reader,"org.codehaus.stax2.internNames") &&
-            getBoolProp(reader,"org.codehaus.stax2.internNsUris"))
+                getBoolProp(reader,"org.codehaus.stax2.internNsUris"))
             ; // no need for interning
         else
         if (isZephyr)
@@ -219,8 +219,8 @@
         int nsCount = staxStreamReader.getNamespaceCount();
         for (int i = 0; i < nsCount; i++) {
             visitor.startPrefixMapping(
-                fixNull(staxStreamReader.getNamespacePrefix(i)),
-                fixNull(staxStreamReader.getNamespaceURI(i)));
+                    fixNull(staxStreamReader.getNamespacePrefix(i)),
+                    fixNull(staxStreamReader.getNamespaceURI(i)));
         }
 
         // fire startElement
@@ -310,13 +310,13 @@
     protected void handleCharacters() throws XMLStreamException, SAXException {
         if( predictor.expectText() )
             buffer.append(
-                staxStreamReader.getTextCharacters(),
-                staxStreamReader.getTextStart(),
-                staxStreamReader.getTextLength() );
+                    staxStreamReader.getTextCharacters(),
+                    staxStreamReader.getTextStart(),
+                    staxStreamReader.getTextLength() );
     }
 
     private void processText( boolean ignorable ) throws SAXException {
-        if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer))) {
+        if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer) || context.getCurrentState().isMixed())) {
             if(textReported) {
                 textReported = false;
             } else {