--- old/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java 2014-06-03 11:31:58.000000000 +0200 +++ new/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java 2014-06-03 11:31:57.000000000 +0200 @@ -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 @@ -198,20 +198,19 @@ /** * 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 +239,7 @@ * @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 +255,22 @@ * 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 +284,8 @@ this.prev = prev; if (prev!=null) { prev.next = this; + if (prev.mixed) // parent is in mixed mode + this.mixed = true; } } @@ -289,7 +295,7 @@ } if (next==null) { assert current == this; - allocateMoreStates(); + next = new State(this); } nil = false; State n = next; @@ -304,11 +310,71 @@ 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 +414,6 @@ 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 +460,6 @@ 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 +563,15 @@ @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(); }