src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 408
b0610cd08440
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Thu Apr 04 19:05:24 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Tue Apr 09 14:51:13 2013 +0100
     1.3 @@ -142,6 +142,7 @@
     1.4  
     1.5          private ThreadLocal<BeanT> target = new ThreadLocal<BeanT>();
     1.6          private ThreadLocal<ValueT> map = new ThreadLocal<ValueT>();
     1.7 +        private int depthCounter = 0; // needed to clean ThreadLocals
     1.8  
     1.9          @Override
    1.10          public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
    1.11 @@ -149,6 +150,7 @@
    1.12              try {
    1.13                  target.set((BeanT)state.prev.target);
    1.14                  map.set(acc.get(target.get()));
    1.15 +                depthCounter++;
    1.16                  if(map.get() == null) {
    1.17                      map.set(ClassFactory.create(mapImplClass));
    1.18                  }
    1.19 @@ -166,7 +168,10 @@
    1.20              super.leaveElement(state, ea);
    1.21              try {
    1.22                  acc.set(target.get(), map.get());
    1.23 -                target.remove();
    1.24 +                if (--depthCounter == 0) {
    1.25 +                    target.remove();
    1.26 +                    map.remove();
    1.27 +                }
    1.28              } catch (AccessorException ex) {
    1.29                  handleGenericException(ex,true);
    1.30              }

mercurial