aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraefimov <none@none>2014-08-31 16:14:36 +0400
committeraefimov <none@none>2014-08-31 16:14:36 +0400
commit111e774d9130c576bd7ed62bef0bb61f4ed08240 (patch)
tree4f30534701080804f26accb8c6be53fa522570ec /src
parent2ea0a817f92cd58af57e90f4bf8d61db40b106c0 (diff)
downloadjdk8u_jaxws-111e774d9130c576bd7ed62bef0bb61f4ed08240.tar.gz
8036981: JAXB not preserving formatting for xsd:any Mixed content
Reviewed-by: lancea, mkos
Diffstat (limited to 'src')
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java14
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java22
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java4
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java8
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java26
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java4
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java8
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java6
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java20
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java4
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java8
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java14
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java4
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java16
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java6
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java12
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java4
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java117
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java17
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java10
-rw-r--r--src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java4
21 files changed, 181 insertions, 147 deletions
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java
index 431e9222..4cef4dde 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -79,19 +79,19 @@ final class ArrayBeanInfoImpl extends JaxBeanInfo {
@Override
public void startElement(UnmarshallingContext.State state, TagName ea) {
- state.target = new ArrayList();
+ state.setTarget(new ArrayList());
}
@Override
public void leaveElement(UnmarshallingContext.State state, TagName ea) {
- state.target = toArray((List)state.target);
+ state.setTarget(toArray((List)state.getTarget()));
}
@Override
public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
if(ea.matches("","item")) {
- state.loader = itemLoader;
- state.receiver = this;
+ state.setLoader(itemLoader);
+ state.setReceiver(this);
} else {
super.childElement(state,ea);
}
@@ -103,9 +103,9 @@ final class ArrayBeanInfoImpl extends JaxBeanInfo {
}
public void receive(UnmarshallingContext.State state, Object o) {
- ((List)state.target).add(o);
+ ((List)state.getTarget()).add(o);
}
- };
+ }
protected Object toArray( List list ) {
int len = list.size();
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java
index a2b96889..58bcbdf5 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -208,8 +208,8 @@ public final class ElementBeanInfoImpl extends JaxBeanInfo<JAXBElement> {
@Override
public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
- state.loader = core;
- state.intercepter = this;
+ state.setLoader(core);
+ state.setIntercepter(this);
// TODO: make sure there aren't too many duplicate of this code
// create the object to unmarshal
@@ -231,21 +231,21 @@ public final class ElementBeanInfoImpl extends JaxBeanInfo<JAXBElement> {
fireBeforeUnmarshal(ElementBeanInfoImpl.this, child, state);
context.recordOuterPeer(child);
- UnmarshallingContext.State p = state.prev;
- p.backup = p.target;
- p.target = child;
+ UnmarshallingContext.State p = state.getPrev();
+ p.setBackup(p.getTarget());
+ p.setTarget(child);
core.startElement(state,ea);
}
public Object intercept(UnmarshallingContext.State state, Object o) throws SAXException {
- JAXBElement e = (JAXBElement)state.target;
- state.target = state.backup;
- state.backup = null;
+ JAXBElement e = (JAXBElement)state.getTarget();
+ state.setTarget(state.getBackup());
+ state.setBackup(null);
- if (state.nil) {
+ if (state.isNil()) {
e.setNil(true);
- state.nil = false;
+ state.setNil(false);
}
if(o!=null)
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java
index c4dd4780..4ce08973 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -90,7 +90,7 @@ final class ValueListBeanInfoImpl extends JaxBeanInfo {
idx = p;
}
- state.target = toArray(r);
+ state.setTarget(toArray(r));
}
};
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java
index 8e2b0c33..aaa286ee 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -98,7 +98,7 @@ abstract class ArrayERProperty<BeanT,ListT,ItemT> extends ArrayProperty<BeanT,Li
UnmarshallingContext context = state.getContext();
context.startScope(1);
// inherit the target so that our children can access its target
- state.target = state.prev.target;
+ state.setTarget(state.getPrev().getTarget());
// start it now, so that even if there's no children we can still return empty collection
context.getScope(0).start(acc,lister);
@@ -116,8 +116,8 @@ abstract class ArrayERProperty<BeanT,ListT,ItemT> extends ArrayProperty<BeanT,Li
super.childElement(state,ea);
return;
}
- state.loader = child.loader;
- state.receiver = child.receiver;
+ state.setLoader(child.loader);
+ state.setReceiver(child.receiver);
}
@Override
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java
index 82420725..5ae4bba5 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -148,18 +148,18 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl
public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
// create or obtain the Map object
try {
- target.set((BeanT)state.prev.target);
+ target.set((BeanT)state.getPrev().getTarget());
map.set(acc.get(target.get()));
depthCounter++;
if(map.get() == null) {
map.set(ClassFactory.create(mapImplClass));
}
map.get().clear();
- state.target = map.get();
+ state.setTarget(map.get());
} catch (AccessorException e) {
// recover from error by setting a dummy Map that receives and discards the values
handleGenericException(e,true);
- state.target = new HashMap();
+ state.setTarget(new HashMap());
}
}
@@ -180,7 +180,7 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl
@Override
public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
if(ea.matches(entryTag)) {
- state.loader = entryLoader;
+ state.setLoader(entryLoader);
} else {
super.childElement(state,ea);
}
@@ -200,26 +200,26 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl
private final Loader entryLoader = new Loader(false) {
@Override
public void startElement(UnmarshallingContext.State state, TagName ea) {
- state.target = new Object[2]; // this is inefficient
+ state.setTarget(new Object[2]); // this is inefficient
}
@Override
public void leaveElement(UnmarshallingContext.State state, TagName ea) {
- Object[] keyValue = (Object[])state.target;
- Map map = (Map) state.prev.target;
+ Object[] keyValue = (Object[])state.getTarget();
+ Map map = (Map) state.getPrev().getTarget();
map.put(keyValue[0],keyValue[1]);
}
@Override
public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
if(ea.matches(keyTag)) {
- state.loader = keyLoader;
- state.receiver = keyReceiver;
+ state.setLoader(keyLoader);
+ state.setReceiver(keyReceiver);
return;
}
if(ea.matches(valueTag)) {
- state.loader = valueLoader;
- state.receiver = valueReceiver;
+ state.setLoader(valueLoader);
+ state.setReceiver(valueReceiver);
return;
}
super.childElement(state,ea);
@@ -237,7 +237,7 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl
this.index = index;
}
public void receive(UnmarshallingContext.State state, Object o) {
- ((Object[])state.target)[index] = o;
+ ((Object[])state.getTarget())[index] = o;
}
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java
index 4493d994..7923cab2 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -148,7 +148,7 @@ public abstract class Accessor<BeanT, ValueT> implements Receiver {
public void receive(UnmarshallingContext.State state, Object o) throws SAXException {
try {
- set((BeanT) state.target, (ValueT) o);
+ set((BeanT) state.getTarget(), (ValueT) o);
} catch (AccessorException e) {
Loader.handleGenericException(e, true);
} catch (IllegalAccessError iae) {
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java
index 8ec39ca0..bfa62502 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -44,10 +44,10 @@ public final class DefaultValueLoaderDecorator extends Loader {
@Override
public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
// install the default value, but don't override the one given by the parent loader
- if(state.elementDefaultValue==null)
- state.elementDefaultValue = defaultValue;
+ if(state.getElementDefaultValue() == null)
+ state.setElementDefaultValue(defaultValue);
- state.loader = l;
+ state.setLoader(l);
l.startElement(state,ea);
}
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java
index aebb713e..931bec71 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -44,8 +44,8 @@ public final class Discarder extends Loader {
@Override
public void childElement(UnmarshallingContext.State state, TagName ea) {
- state.target = null;
+ state.setTarget(null);
// registering this allows the discarder to process the whole subtree.
- state.loader = this;
+ state.setLoader(this);
}
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java
index 29cfa4ad..30c8d755 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java
@@ -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
@@ -99,10 +99,10 @@ public class DomLoader<ResultT extends Result> extends Loader {
@Override
public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
UnmarshallingContext context = state.getContext();
- if (state.target == null)
- state.target = new State(context);
+ if (state.getTarget() == null)
+ state.setTarget(new State(context));
- State s = (State) state.target;
+ State s = (State) state.getTarget();
try {
s.declarePrefixes(context, context.getNewlyDeclaredPrefixes());
s.handler.startElement(ea.uri, ea.local, ea.getQname(), ea.atts);
@@ -114,10 +114,10 @@ public class DomLoader<ResultT extends Result> extends Loader {
@Override
public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
- state.loader = this;
- State s = (State) state.prev.target;
+ state.setLoader(this);
+ State s = (State) state.getPrev().getTarget();
s.depth++;
- state.target = s;
+ state.setTarget(s);
}
@Override
@@ -125,7 +125,7 @@ public class DomLoader<ResultT extends Result> extends Loader {
if(text.length()==0)
return; // there's no point in creating an empty Text node in DOM.
try {
- State s = (State) state.target;
+ State s = (State) state.getTarget();
s.handler.characters(text.toString().toCharArray(),0,text.length());
} catch( SAXException e ) {
state.getContext().handleError(e);
@@ -135,7 +135,7 @@ public class DomLoader<ResultT extends Result> extends Loader {
@Override
public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
- State s = (State) state.target;
+ State s = (State) state.getTarget();
UnmarshallingContext context = state.getContext();
try {
@@ -157,7 +157,7 @@ public class DomLoader<ResultT extends Result> extends Loader {
}
// we are done
- state.target = s.getElement();
+ state.setTarget(s.getElement());
}
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java
index f7ff0f01..300f5f33 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -47,7 +47,7 @@ public class LeafPropertyLoader extends Loader {
public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException {
try {
- xacc.parse(state.prev.target,text);
+ xacc.parse(state.getPrev().getTarget(), text);
} catch (AccessorException e) {
handleGenericException(e,true);
} catch (RuntimeException e) {
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java
index 8354632d..5c13bf34 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -55,9 +55,9 @@ public final class LeafPropertyXsiLoader extends Loader {
@Override
public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
- state.loader = selectLoader(state, ea);
-
- state.loader.startElement(state, ea);
+ final Loader loader = selectLoader(state, ea);
+ state.setLoader(loader);
+ loader.startElement(state, ea);
}
protected Loader selectLoader(UnmarshallingContext.State state, TagName ea) throws SAXException {
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java
index 9c9ccea3..f3d6c859 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -88,8 +88,8 @@ public abstract class Loader {
public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
// notify the error, then recover by ignoring the whole element.
reportUnexpectedChildElement(ea, true);
- state.loader = Discarder.INSTANCE;
- state.receiver = null;
+ state.setLoader(Discarder.INSTANCE);
+ state.setReceiver(null);
}
@SuppressWarnings({"StringEquality"})
@@ -195,10 +195,10 @@ public abstract class Loader {
UnmarshallingContext context = state.getContext();
Unmarshaller.Listener listener = context.parent.getListener();
if(beanInfo.hasBeforeUnmarshalMethod()) {
- beanInfo.invokeBeforeUnmarshalMethod(context.parent, child, state.prev.target);
+ beanInfo.invokeBeforeUnmarshalMethod(context.parent, child, state.getPrev().getTarget());
}
if(listener!=null) {
- listener.beforeUnmarshal(child, state.prev.target);
+ listener.beforeUnmarshal(child, state.getPrev().getTarget());
}
}
}
@@ -215,10 +215,10 @@ public abstract class Loader {
UnmarshallingContext context = state.getContext();
Unmarshaller.Listener listener = context.parent.getListener();
if(beanInfo.hasAfterUnmarshalMethod()) {
- beanInfo.invokeAfterUnmarshalMethod(context.parent, child, state.target);
+ beanInfo.invokeAfterUnmarshalMethod(context.parent, child, state.getTarget());
}
if(listener!=null)
- listener.afterUnmarshal(child, state.target);
+ listener.afterUnmarshal(child, state.getTarget());
}
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java
index 466a8863..67adf61e 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -41,7 +41,7 @@ public abstract class ProxyLoader extends Loader {
@Override
public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
Loader loader = selectLoader(state,ea);
- state.loader = loader;
+ state.setLoader(loader);
loader.startElement(state,ea);
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java
index 44998166..a7e9abc6 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, 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
@@ -144,17 +144,7 @@ public final class SAXConnector implements UnmarshallerHandler {
if( qname==null || qname.length()==0 )
qname=local;
-
- boolean ignorable = true;
- StructureLoader sl;
-
- // not null only if element content is processed (StructureLoader is used)
- // ugly
- if((sl = this.context.getStructureLoader()) != null) {
- ignorable = ((ClassBeanInfoImpl)sl.getBeanInfo()).hasElementOnlyContentModel();
- }
-
- processText(ignorable);
+ processText(!context.getCurrentState().isMixed());
tagName.uri = uri;
tagName.local = local;
@@ -204,7 +194,7 @@ public final class SAXConnector implements UnmarshallerHandler {
}
private void processText( boolean ignorable ) throws SAXException {
- if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer)))
+ if (predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer)))
next.text(buffer);
buffer.setLength(0);
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java
index 4b8392ba..bfd98e9b 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -97,7 +97,7 @@ public final class Scope<BeanT,PropT,ItemT,PackT> {
public void add( Accessor<BeanT,PropT> acc, Lister<BeanT,PropT,ItemT,PackT> lister, ItemT value) throws SAXException{
try {
if(!hasStarted()) {
- this.bean = (BeanT)context.getCurrentState().target;
+ this.bean = (BeanT)context.getCurrentState().getTarget();
this.acc = acc;
this.lister = lister;
this.pack = lister.startPacking(bean,acc);
@@ -121,7 +121,7 @@ public final class Scope<BeanT,PropT,ItemT,PackT> {
public void start( Accessor<BeanT,PropT> acc, Lister<BeanT,PropT,ItemT,PackT> lister) throws SAXException{
try {
if(!hasStarted()) {
- this.bean = (BeanT)context.getCurrentState().target;
+ this.bean = (BeanT)context.getCurrentState().getTarget();
this.acc = acc;
this.lister = lister;
this.pack = lister.startPacking(bean,acc);
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java
index 203e8549..0d4fa264 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -172,7 +172,7 @@ public final class StructureLoader extends Loader {
context.recordInnerPeer(child);
- state.target = child;
+ state.setTarget(child);
fireBeforeUnmarshal(beanInfo, child, state);
@@ -197,7 +197,7 @@ public final class StructureLoader extends Loader {
String qname = atts.getQName(i);
if(atts.getURI(i).equals(WellKnownNamespace.XML_SCHEMA_INSTANCE))
continue; // xsi:* attributes are meant to be processed by us, not by user apps.
- Object o = state.target;
+ Object o = state.getTarget();
Map<QName,String> map = attCatchAll.get(o);
if(map==null) {
// TODO: use ClassFactory.inferImplClass(sig,knownImplClasses)
@@ -250,8 +250,8 @@ public final class StructureLoader extends Loader {
}
}
- state.loader = child.loader;
- state.receiver = child.receiver;
+ state.setLoader(child.loader);
+ state.setReceiver(child.receiver);
}
@Override
@@ -273,7 +273,7 @@ public final class StructureLoader extends Loader {
@Override
public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
state.getContext().endScope(frameSize);
- fireAfterUnmarshal(beanInfo, state.target, state.prev);
+ fireAfterUnmarshal(beanInfo, state.getTarget(), state.getPrev());
}
private static final QNameMap<TransducedAccessor> EMPTY = new QNameMap<TransducedAccessor>();
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java
index c6fb5543..a482ae6a 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -51,7 +51,7 @@ public class TextLoader extends Loader {
public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException {
try {
- state.target = xducer.parse(text);
+ state.setTarget(xducer.parse(text));
} catch (AccessorException e) {
handleGenericException(e,true);
} catch (RuntimeException e) {
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java
index 35519196..c51d4fe3 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, 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
@@ -35,8 +35,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBElement;
@@ -198,20 +196,19 @@ public final class UnmarshallingContext extends Coordinator
/**
* Loader that owns this element.
*/
- public Loader loader;
+ private Loader loader;
/**
* Once {@link #loader} is completed, this receiver
* receives the result.
*/
- public Receiver receiver;
-
- public Intercepter intercepter;
+ private Receiver receiver;
+ private Intercepter intercepter;
/**
* Object being unmarshalled by this {@link #loader}.
*/
- public Object target;
+ private Object target;
/**
* Hack for making JAXBElement unmarshalling work.
@@ -240,7 +237,7 @@ public final class UnmarshallingContext extends Coordinator
* @see ElementBeanInfoImpl.IntercepterLoader#startElement(State, TagName)
* @see ElementBeanInfoImpl.IntercepterLoader#intercept(State, Object)
*/
- public Object backup;
+ private Object backup;
/**
* Number of {@link UnmarshallingContext#nsBind}s declared thus far.
@@ -256,17 +253,22 @@ public final class UnmarshallingContext extends Coordinator
* or by a child {@link Loader} when
* {@link Loader#startElement(State, TagName)} is called.
*/
- public String elementDefaultValue;
+ private String elementDefaultValue;
/**
* {@link State} for the parent element
*
* {@link State} objects form a doubly linked list.
*/
- public State prev;
+ private State prev;
private State next;
- public boolean nil = false;
+ private boolean nil = false;
+
+ /**
+ * specifies that we are working with mixed content
+ */
+ private boolean mixed = false;
/**
* Gets the context.
@@ -280,6 +282,8 @@ public final class UnmarshallingContext extends Coordinator
this.prev = prev;
if (prev!=null) {
prev.next = this;
+ if (prev.mixed) // parent is in mixed mode
+ this.mixed = true;
}
}
@@ -289,7 +293,7 @@ public final class UnmarshallingContext extends Coordinator
}
if (next==null) {
assert current == this;
- allocateMoreStates();
+ next = new State(this);
}
nil = false;
State n = next;
@@ -304,11 +308,71 @@ public final class UnmarshallingContext extends Coordinator
assert prev!=null;
loader = null;
nil = false;
+ mixed = false;
receiver = null;
intercepter = null;
elementDefaultValue = null;
target = null;
current = prev;
+ next = null;
+ }
+
+ public boolean isMixed() {
+ return mixed;
+ }
+
+ public Object getTarget() {
+ return target;
+ }
+
+ public void setLoader(Loader loader) {
+ if (loader instanceof StructureLoader) // set mixed mode
+ mixed = !((StructureLoader)loader).getBeanInfo().hasElementOnlyContentModel();
+ this.loader = loader;
+ }
+
+ public void setReceiver(Receiver receiver) {
+ this.receiver = receiver;
+ }
+
+ public State getPrev() {
+ return prev;
+ }
+
+ public void setIntercepter(Intercepter intercepter) {
+ this.intercepter = intercepter;
+ }
+
+ public void setBackup(Object backup) {
+ this.backup = backup;
+ }
+
+ public void setTarget(Object target) {
+ this.target = target;
+ }
+
+ public Object getBackup() {
+ return backup;
+ }
+
+ public boolean isNil() {
+ return nil;
+ }
+
+ public void setNil(boolean nil) {
+ this.nil = nil;
+ }
+
+ public Loader getLoader() {
+ return loader;
+ }
+
+ public String getElementDefaultValue() {
+ return elementDefaultValue;
+ }
+
+ public void setElementDefaultValue(String elementDefaultValue) {
+ this.elementDefaultValue = elementDefaultValue;
}
}
@@ -348,7 +412,6 @@ public final class UnmarshallingContext extends Coordinator
this.parent = _parent;
this.assoc = assoc;
this.root = this.current = new State(null);
- allocateMoreStates();
}
public void reset(InfosetScanner scanner,boolean isInplaceMode, JaxBeanInfo expectedType, IDResolver idResolver) {
@@ -395,23 +458,6 @@ public final class UnmarshallingContext extends Coordinator
return null;
}
- /**
- * Allocates a few more {@link State}s.
- *
- * Allocating multiple {@link State}s at once allows those objects
- * to be allocated near each other, which reduces the working set
- * of CPU. It improves the chance the relevant data is in the cache.
- */
- private void allocateMoreStates() {
- // this method should be used only when we run out of a state.
- assert current.next==null;
-
- State s = current;
- for (int i=0; i<8; i++) {
- s = new State(s);
- }
- }
-
public void clearStates() {
State last = current;
while (last.next != null) last = last.next;
@@ -515,16 +561,15 @@ public final class UnmarshallingContext extends Coordinator
@Override
public void text(CharSequence pcdata) throws SAXException {
- State cur = current;
pushCoordinator();
try {
- if(cur.elementDefaultValue!=null) {
- if(pcdata.length()==0) {
+ if (current.elementDefaultValue != null) {
+ if (pcdata.length() == 0) {
// send the default value into the unmarshaller instead
- pcdata = cur.elementDefaultValue;
+ pcdata = current.elementDefaultValue;
}
}
- cur.loader.text(cur,pcdata);
+ current.loader.text(current, pcdata);
} finally {
popCoordinator();
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java
index f8e591b6..1bc81f0d 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -49,18 +49,17 @@ public class ValuePropertyLoader extends Loader {
public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException {
try {
- xacc.parse(state.target,text);
+ xacc.parse(state.getTarget(),text);
} catch (AccessorException e) {
handleGenericException(e,true);
} catch (RuntimeException e) {
- if(state.prev != null) {
- if(state.prev.target instanceof JAXBElement) {
- ; // do nothing - issue 601 - don't report exceptions like
- // NumberFormatException when unmarshalling "nillable" element
- // (I suppose JAXBElement indicates this
- } else {
+ if(state.getPrev() != null) {
+ if (!(state.getPrev().getTarget() instanceof JAXBElement))
handleParseConversionException(state,e);
- }
+ // else
+ // do nothing - issue 601 - don't report exceptions like
+ // NumberFormatException when unmarshalling "nillable" element
+ // (I suppose JAXBElement indicates this
} else {
handleParseConversionException(state,e);
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java
index 6247f020..c01acf34 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, 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
@@ -62,7 +62,7 @@ public class XsiNilLoader extends ProxyLoader {
onNil(state);
boolean hasOtherAttributes = (ea.atts.getLength() - 1) > 0;
// see issues 6759703 and 565 - need to preserve attributes even if the element is nil; only when the type is stored in JAXBElement
- if (!(hasOtherAttributes && (state.prev.target instanceof JAXBElement))) {
+ if (!(hasOtherAttributes && (state.getPrev().getTarget() instanceof JAXBElement))) {
return Discarder.INSTANCE;
}
}
@@ -96,8 +96,8 @@ public class XsiNilLoader extends ProxyLoader {
@Override
protected void onNil(UnmarshallingContext.State state) throws SAXException {
try {
- acc.set(state.prev.target,null);
- state.prev.nil = true;
+ acc.set(state.getPrev().getTarget(),null);
+ state.getPrev().setNil(true);
} catch (AccessorException e) {
handleGenericException(e,true);
}
@@ -113,7 +113,7 @@ public class XsiNilLoader extends ProxyLoader {
@Override
protected void onNil(UnmarshallingContext.State state) {
// let the receiver add this to the lister
- state.target = null;
+ state.setTarget(null);
}
}
}
diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java
index f35a3f52..654f1940 100644
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, 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
@@ -61,7 +61,7 @@ public class XsiTypeLoader extends Loader {
beanInfo = defaultBeanInfo;
Loader loader = beanInfo.getLoader(null,false);
- state.loader = loader;
+ state.setLoader(loader);
loader.startElement(state,ea);
}