# HG changeset patch # User andrew # Date 1317172458 -3600 # Node ID 1a5e2ee2e85313ba61e3e1bbef63e64309d4c642 # Parent 5d45300e33bbb6a265050b77ee187c279911bdbd 7042773: Integrate JAXWS 2.2.4 update to JDK7 diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/LICENSE --- a/sources/jaxws_src/LICENSE Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/LICENSE Wed Sep 28 02:14:18 2011 +0100 @@ -325,11 +325,11 @@ "CLASSPATH" EXCEPTION TO THE GPL -Certain source files distributed by Oracle America and/or its affiliates are -subject to the following clarification and special exception to the GPL, but -only where Oracle has expressly included in the particular source file's header -the words "Oracle designates this particular file as subject to the "Classpath" -exception as provided by Oracle in the LICENSE file that accompanied this code." +Certain source files distributed by Sun Microsystems, Inc. are subject to +the following clarification and special exception to the GPL, but only where +Sun has expressly included in the particular source file's header the words +"Sun designates this particular file as subject to the "Classpath" exception +as provided by Sun in the LICENSE file that accompanied this code." Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/codemodel/internal/CodeWriter.java --- a/sources/jaxws_src/src/com/sun/codemodel/internal/CodeWriter.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/codemodel/internal/CodeWriter.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -83,6 +83,7 @@ // can't change this signature to Encoder because // we can't have Encoder in method signature private final CharsetEncoder encoder = EncoderFactory.createEncoder(bw.getEncoding()); + @Override protected boolean requireEscaping(int ch) { // control characters if( ch<0x20 && " \t\r\n".indexOf(ch)==-1 ) return true; diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/codemodel/internal/JAnnotationUse.java --- a/sources/jaxws_src/src/com/sun/codemodel/internal/JAnnotationUse.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/codemodel/internal/JAnnotationUse.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -27,6 +27,7 @@ import java.lang.annotation.Annotation; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; @@ -54,6 +55,14 @@ this.clazz = clazz; } + public JClass getAnnotationClass() { + return clazz; + } + + public Map getAnnotationMembers() { + return Collections.unmodifiableMap(memberValues); + } + private JCodeModel owner() { return clazz.owner(); } @@ -322,8 +331,8 @@ * be added to it using the same or the overloaded methods. */ public JAnnotationUse param(String name, JType type){ - JClass clazz = type.boxify(); - addValue(name, new JAnnotationStringValue ( clazz.dotclass() )); + JClass c = type.boxify(); + addValue(name, new JAnnotationStringValue ( c.dotclass() )); return this; } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/codemodel/internal/JDefinedClass.java --- a/sources/jaxws_src/src/com/sun/codemodel/internal/JDefinedClass.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/codemodel/internal/JDefinedClass.java Wed Sep 28 02:14:18 2011 +0100 @@ -56,7 +56,6 @@ /** Name of this class. Null if anonymous. */ private String name = null; - /** Modifiers for the class declaration */ private JMods mods; @@ -887,4 +886,13 @@ annotations = new ArrayList(); return Collections.unmodifiableCollection(annotations); } + + /** + * @return + * the current modifiers of this class. + * Always return non-null valid object. + */ + public JMods mods() { + return mods; + } } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/codemodel/internal/JMods.java --- a/sources/jaxws_src/src/com/sun/codemodel/internal/JMods.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/codemodel/internal/JMods.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -28,7 +28,6 @@ import java.io.PrintWriter; import java.io.StringWriter; - /** * Modifier groups. */ @@ -37,24 +36,15 @@ // // mask // - private static int VAR - = JMod.FINAL; - - private static int FIELD - = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED - | JMod.STATIC | JMod.FINAL - | JMod.TRANSIENT | JMod.VOLATILE); - - private static int METHOD - = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED | JMod.FINAL - | JMod.ABSTRACT | JMod.STATIC | JMod.NATIVE | JMod.SYNCHRONIZED); - - private static int CLASS - = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED - | JMod.STATIC | JMod.FINAL | JMod.ABSTRACT ); - + private static int VAR = JMod.FINAL; + private static int FIELD = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED + | JMod.STATIC | JMod.FINAL + | JMod.TRANSIENT | JMod.VOLATILE); + private static int METHOD = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED | JMod.FINAL + | JMod.ABSTRACT | JMod.STATIC | JMod.NATIVE | JMod.SYNCHRONIZED); + private static int CLASS = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED + | JMod.STATIC | JMod.FINAL | JMod.ABSTRACT); private static int INTERFACE = JMod.PUBLIC; - /** bit-packed representation of modifiers. */ private int mods; @@ -70,10 +60,11 @@ } private static void check(int mods, int legal, String what) { - if ((mods & ~legal) != 0) + if ((mods & ~legal) != 0) { throw new IllegalArgumentException("Illegal modifiers for " + what + ": " + new JMods(mods).toString()); + } /* ## check for illegal combinations too */ } @@ -115,13 +106,33 @@ } public void setSynchronized(boolean newValue) { - setFlag( JMod.SYNCHRONIZED, newValue ); + setFlag(JMod.SYNCHRONIZED, newValue); + } + + public void setPrivate() { + setFlag(JMod.PUBLIC, false); + setFlag(JMod.PROTECTED, false); + setFlag(JMod.PRIVATE, true); } - // TODO: more + public void setProtected() { + setFlag(JMod.PUBLIC, false); + setFlag(JMod.PROTECTED, true); + setFlag(JMod.PRIVATE, false); + } - private void setFlag( int bit, boolean newValue ) { - mods = (mods & ~bit) | (newValue?bit:0); + public void setPublic() { + setFlag(JMod.PUBLIC, true); + setFlag(JMod.PROTECTED, false); + setFlag(JMod.PRIVATE, false); + } + + public void setFinal(boolean newValue) { + setFlag(JMod.FINAL, newValue); + } + + private void setFlag(int bit, boolean newValue) { + mods = (mods & ~bit) | (newValue ? bit : 0); } public void generate(JFormatter f) { @@ -135,13 +146,13 @@ if ((mods & JMod.SYNCHRONIZED) != 0) f.p("synchronized"); if ((mods & JMod.TRANSIENT) != 0) f.p("transient"); if ((mods & JMod.VOLATILE) != 0) f.p("volatile"); - } + } + @Override public String toString() { StringWriter s = new StringWriter(); JFormatter f = new JFormatter(new PrintWriter(s)); this.generate(f); return s.toString(); } - } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/codemodel/internal/JNarrowedClass.java --- a/sources/jaxws_src/src/com/sun/codemodel/internal/JNarrowedClass.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/codemodel/internal/JNarrowedClass.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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,6 +25,7 @@ package com.sun.codemodel.internal; +import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Collections; @@ -59,21 +60,22 @@ this.args = args; } + @Override public JClass narrow( JClass clazz ) { List newArgs = new ArrayList(args); newArgs.add(clazz); return new JNarrowedClass(basis,newArgs); } + @Override public JClass narrow( JClass... clazz ) { List newArgs = new ArrayList(args); - for (JClass c : clazz) - newArgs.add(c); + newArgs.addAll(Arrays.asList(clazz)); return new JNarrowedClass(basis,newArgs); } public String name() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(basis.name()); buf.append('<'); boolean first = true; @@ -104,6 +106,7 @@ return buf.toString(); } + @Override public String binaryName() { StringBuilder buf = new StringBuilder(); buf.append(basis.binaryName()); @@ -120,6 +123,7 @@ return buf.toString(); } + @Override public void generate(JFormatter f) { f.t(basis).p('<').g(args).p(JFormatter.CLOSE_TYPE_ARGS); } @@ -164,6 +168,7 @@ }; } + @Override public JClass erasure() { return basis; } @@ -176,6 +181,7 @@ return basis.isAbstract(); } + @Override public boolean isArray() { return false; } @@ -185,11 +191,13 @@ // Equality is based on value // + @Override public boolean equals(Object obj) { if(!(obj instanceof JNarrowedClass)) return false; return fullName().equals(((JClass)obj).fullName()); } + @Override public int hashCode() { return fullName().hashCode(); } @@ -211,6 +219,7 @@ return this; } + @Override public List getTypeParameters() { return args; } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/tools/internal/xjc/Driver.java --- a/sources/jaxws_src/src/com/sun/tools/internal/xjc/Driver.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/tools/internal/xjc/Driver.java Wed Sep 28 02:14:18 2011 +0100 @@ -59,7 +59,7 @@ /** - * CUI of XJC. + * Command Line Interface of XJC. */ public class Driver { @@ -501,13 +501,12 @@ * {@link Options} object. */ public static void usage( @Nullable Options opts, boolean privateUsage ) { - if( privateUsage ) { + System.out.println(Messages.format(Messages.DRIVER_PUBLIC_USAGE)); + if (privateUsage) { System.out.println(Messages.format(Messages.DRIVER_PRIVATE_USAGE)); - } else { - System.out.println(Messages.format(Messages.DRIVER_PUBLIC_USAGE)); } - if( opts!=null && opts.getAllPlugins().isEmpty()) { + if( opts!=null && !opts.getAllPlugins().isEmpty()) { System.out.println(Messages.format(Messages.ADDON_USAGE)); for (Plugin p : opts.getAllPlugins()) { System.out.println(p.getUsage()); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/tools/internal/xjc/MessageBundle.properties --- a/sources/jaxws_src/src/com/sun/tools/internal/xjc/MessageBundle.properties Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/tools/internal/xjc/MessageBundle.properties Wed Sep 28 02:14:18 2011 +0100 @@ -33,47 +33,16 @@ unknown file Driver.Private.Usage = \ -Usage: xjc [-options ...] ... [-b ] ...\n\ -If dir is specified, all schema files in it will be compiled.\n\ -If jar is specified, /META-INF/sun-jaxb.episode binding file will be compiled.\n\ -Options:\n\ +Additional private testing options:\n\ \ \ -debug : run in debug mode (includes -verbose)\n\ -\ \ -nv : do not perform strict validation of the input schema(s)\n\ -\ \ -extension : allow vendor extensions - do not strictly follow the\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Compatibility Rules and App E.2 from the JAXB Spec\n\ \ \ -mode : run XJC in other running mode\n\ -\ \ -b : specify external bindings files (each must have its own -b)\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ If a directory is given, **/*.xjb is searched\n\ -\ \ -d : generated files will go into this directory\n\ -\ \ -httpproxy : set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost:proxyPort\n\ -\ \ -httpproxyfile : Works like -httpproxy but takes the argument in a file to protect password \n\ -\ \ -classpath : specify where to find user class files\n\ -\ \ -catalog : specify catalog files to resolve external entity references\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ support TR9401, XCatalog, and OASIS XML Catalog format.\n\ -\ \ -readOnly : generated files will be in read-only mode\n\ -\ \ -npa : suppress generation of package level annotations (**/package-info.java)\n\ -\ \ -no-header : suppress generation of a file header with timestamp\n\ -\ \ -target 2.0 : behave like XJC 2.0 and generate code that doesn't use any 2.1 features.\n\ -\ \ -enableIntrospection : enable correct generation of Boolean getters/setters to enable Bean Introspection apis \n\ -\ \ -contentForWildcard : enable correct generation of Boolean getters/setters to enable Bean Introspection apis \n\ \ \ -private : display this help message\n\ -\ \ -xmlschema : treat input as W3C XML Schema (default)\n\ -\ \ -relaxng : treat input as RELAX NG (experimental,unsupported)\n\ -\ \ -relaxng-compact : treat input as RELAX NG compact syntax (experimental,unsupported)\n\ -\ \ -dtd : treat input as XML DTD (experimental,unsupported)\n\ -\ \ -wsdl : treat input as WSDL and compile schemas inside it (experimental,unsupported)\n\ -\ \ -version : display version information\n\ -\ \ -fullversion : display version information\n\ -\ \ -verbose : be extra verbose\n\ -\ \ -quiet : suppress compiler output\n\ Mode:\n\ \ \ code : generate Java source code (default)\n\ \ \ dryrun : compile the schema in memory, but don't generate the Java source\n\ \ \ zip : generate Java source code into a zip file specified by the -d option\n\ \ \ sig : dump the signatures of the generated code\n\ \ \ forest : dump transformed DOM forest\n\ -Options in Code mode:\n\ -\ \ -p : specifies the target package\n Driver.Public.Usage = \ Usage: xjc [-options ...] ... [-b ] ...\n\ @@ -95,7 +64,7 @@ \ \ -readOnly : generated files will be in read-only mode\n\ \ \ -npa : suppress generation of package level annotations (**/package-info.java)\n\ \ \ -no-header : suppress generation of a file header with timestamp\n\ -\ \ -target 2.0 : behave like XJC 2.0 and generate code that doesn't use any 2.1 features.\n\ +\ \ -target (2.0|2.1) : behave like XJC 2.0 or 2.1 and generate code that doesn't use any 2.2 features.\n\ \ \ -enableIntrospection : enable correct generation of Boolean getters/setters to enable Bean Introspection apis \n\ \ \ -contentForWildcard : generates content property for types with multiple xs:any derived elements \n\ \ \ -xmlschema : treat input as W3C XML Schema (default)\n\ @@ -194,7 +163,7 @@ xjc 2.2.4 Driver.FullVersion = \ - xjc full version "2.2.4-b113" + xjc full version "2.2.4-b129" Driver.BuildID = 2.2.4 diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/tools/internal/xjc/Options.java --- a/sources/jaxws_src/src/com/sun/tools/internal/xjc/Options.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/tools/internal/xjc/Options.java Wed Sep 28 02:14:18 2011 +0100 @@ -63,6 +63,7 @@ import com.sun.xml.internal.bind.api.impl.NameConverter; import java.net.URI; import java.net.URISyntaxException; +import java.util.Locale; import java.util.logging.Logger; import org.xml.sax.EntityResolver; @@ -892,7 +893,7 @@ + Messages.format(Messages.AT) + "' " + Messages.format(Messages.TIME_FORMAT); - SimpleDateFormat dateFormat = new SimpleDateFormat(format); + SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.ENGLISH); return Messages.format( Messages.FILE_PROLOG_COMMENT, diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/tools/internal/xjc/addon/accessors/PluginImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sources/jaxws_src/src/com/sun/tools/internal/xjc/addon/accessors/PluginImpl.java Wed Sep 28 02:14:18 2011 +0100 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1997, 2011, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.internal.xjc.addon.accessors; + +import com.sun.codemodel.internal.JAnnotationUse; +import com.sun.codemodel.internal.JClass; +import java.io.IOException; +import com.sun.tools.internal.xjc.BadCommandLineException; +import com.sun.tools.internal.xjc.Options; +import com.sun.tools.internal.xjc.Plugin; +import com.sun.tools.internal.xjc.outline.ClassOutline; +import com.sun.tools.internal.xjc.outline.Outline; +import java.lang.reflect.Field; +import java.util.Iterator; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import org.xml.sax.ErrorHandler; + +/** + * Generates synchronized methods. + * + * @author + * Martin Grebac (martin.grebac@sun.com) + */ +public class PluginImpl extends Plugin { + + public String getOptionName() { + return "Xpropertyaccessors"; + } + + public String getUsage() { + return " -Xpropertyaccessors : Use XmlAccessType PROPERTY instead of FIELD for generated classes"; + } + + @Override + public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, IOException { + return 0; // no option recognized + } + + public boolean run( Outline model, Options opt, ErrorHandler errorHandler ) { + + for( ClassOutline co : model.getClasses() ) { + Iterator ann = co.ref.annotations().iterator(); + while (ann.hasNext()) { + try { + JAnnotationUse a = ann.next(); + Field clazzField = a.getClass().getDeclaredField("clazz"); + clazzField.setAccessible(true); + JClass cl = (JClass) clazzField.get(a); + if (cl.equals(model.getCodeModel()._ref(XmlAccessorType.class))) { + a.param("value", XmlAccessType.PROPERTY); + break; + } + } catch (IllegalArgumentException ex) { + Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); + } catch (NoSuchFieldException ex) { + Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); + } catch (SecurityException ex) { + Logger.getLogger(PluginImpl.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + return true; + } + +} diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/tools/internal/xjc/api/package.html --- a/sources/jaxws_src/src/com/sun/tools/internal/xjc/api/package.html Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/tools/internal/xjc/api/package.html Wed Sep 28 02:14:18 2011 +0100 @@ -26,11 +26,11 @@ -API for programatic invocation of XJC and schemagen. +API for programmatic invocation of XJC and schemagen.

This package provides a way to invoke XJC from within another program. -The primarily target of this API is the JAX-WS RI, but we hope that +The primary target of this API is the JAX-WS RI, but we hope that this API would be useful for other integration purposes as well.

Getting Started: Using XJC

@@ -47,7 +47,7 @@ The bind operation causes XJC to do the bulk of the work, such as figuring out what classes to generate, what methods/fields to generate, etc. The obtained model contains useful introspective information about -how the binding was performed (such as relationship between XML types +how the binding was performed (such as the mapping between XML types and generated Java classes)

diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/tools/internal/xjc/generator/bean/field/DefaultFieldRenderer.java --- a/sources/jaxws_src/src/com/sun/tools/internal/xjc/generator/bean/field/DefaultFieldRenderer.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/tools/internal/xjc/generator/bean/field/DefaultFieldRenderer.java Wed Sep 28 02:14:18 2011 +0100 @@ -28,12 +28,10 @@ import java.util.ArrayList; import com.sun.tools.internal.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.internal.xjc.model.CElement; import com.sun.tools.internal.xjc.model.CPropertyInfo; import com.sun.tools.internal.xjc.model.CReferencePropertyInfo; import com.sun.tools.internal.xjc.outline.FieldOutline; import java.io.Serializable; -import java.util.Set; /** * Default implementation of the FieldRendererFactory diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/DatatypeConverterImpl.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/DatatypeConverterImpl.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/DatatypeConverterImpl.java Wed Sep 28 02:14:18 2011 +0100 @@ -781,8 +781,10 @@ * in the output buffer where the further bytes should be placed. */ public static int _printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr) { - int i = offset; - for (; i <= (len - 3); i += 3) { + // encode elements until only 1 or 2 elements are left to encode + int remaining = len; + int i; + for (i = offset;remaining >= 3; remaining -= 3, i += 3) { buf[ptr++] = encode(input[i] >> 2); buf[ptr++] = encode( ((input[i] & 0x3) << 4) @@ -792,21 +794,21 @@ | ((input[i + 2] >> 6) & 0x3)); buf[ptr++] = encode(input[i + 2] & 0x3F); } - if (len - i == 2) { - //(i == len - 2) { - buf[ptr++] = encode(input[i] >> 2); - buf[ptr++] = encode( - ((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); - buf[ptr++] = encode((input[i + 1] & 0xF) << 2); - buf[ptr++] = '='; - } else if (len - i == 1) { - //if (i == len - 1) { + // encode when exactly 1 element (left) to encode + if (remaining == 1) { buf[ptr++] = encode(input[i] >> 2); buf[ptr++] = encode(((input[i]) & 0x3) << 4); buf[ptr++] = '='; buf[ptr++] = '='; } + // encode when exactly 2 elements (left) to encode + if (remaining == 2) { + buf[ptr++] = encode(input[i] >> 2); + buf[ptr++] = encode(((input[i] & 0x3) << 4) + | ((input[i + 1] >> 4) & 0xF)); + buf[ptr++] = encode((input[i + 1] & 0xF) << 2); + buf[ptr++] = '='; + } return ptr; } @@ -822,32 +824,35 @@ */ public static int _printBase64Binary(byte[] input, int offset, int len, byte[] out, int ptr) { byte[] buf = out; - int i = offset; - for (; i <= (len - 3); i += 3) { - buf[ptr++] = encodeByte(input[i] >> 2); + int remaining = len; + int i; + for (i=offset; remaining >= 3; remaining -= 3, i += 3 ) { + buf[ptr++] = encodeByte(input[i]>>2); buf[ptr++] = encodeByte( - ((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); + ((input[i]&0x3)<<4) | + ((input[i+1]>>4)&0xF)); buf[ptr++] = encodeByte( - ((input[i + 1] & 0xF) << 2) - | ((input[i + 2] >> 6) & 0x3)); - buf[ptr++] = encodeByte(input[i + 2] & 0x3F); + ((input[i+1]&0xF)<<2)| + ((input[i+2]>>6)&0x3)); + buf[ptr++] = encodeByte(input[i+2]&0x3F); } - // encode when exactly 2 elements (left) to encode - if (len - i == 2) { - buf[ptr++] = encodeByte(input[i] >> 2); - buf[ptr++] = encodeByte( - ((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); - buf[ptr++] = encodeByte((input[i + 1] & 0xF) << 2); - buf[ptr++] = '='; - } else if (len - i == 1) { - // encode when exactly 1 element (left) to encode - buf[ptr++] = encodeByte(input[i] >> 2); - buf[ptr++] = encodeByte(((input[i]) & 0x3) << 4); + // encode when exactly 1 element (left) to encode + if (remaining == 1) { + buf[ptr++] = encodeByte(input[i]>>2); + buf[ptr++] = encodeByte(((input[i])&0x3)<<4); buf[ptr++] = '='; buf[ptr++] = '='; } + // encode when exactly 2 elements (left) to encode + if (remaining == 2) { + buf[ptr++] = encodeByte(input[i]>>2); + buf[ptr++] = encodeByte( + ((input[i]&0x3)<<4) | + ((input[i+1]>>4)&0xF)); + buf[ptr++] = encodeByte((input[i+1]&0xF)<<2); + buf[ptr++] = '='; + } + return ptr; } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper.java Wed Sep 28 02:14:18 2011 +0100 @@ -63,7 +63,6 @@ * * This method is intended to be overrided by a derived class. * - * *

* As noted in the return value portion of the javadoc, there * are several cases where the preference cannot be honored. @@ -242,7 +241,6 @@ * * * - * * * @return * always return a non-null (but possibly empty) array. The array stores diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/EnumLeafInfoImpl.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/EnumLeafInfoImpl.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/EnumLeafInfoImpl.java Wed Sep 28 02:14:18 2011 +0100 @@ -39,6 +39,8 @@ import com.sun.xml.internal.bind.v2.model.core.Element; import com.sun.xml.internal.bind.v2.model.core.ClassInfo; import com.sun.xml.internal.bind.v2.runtime.Location; +import java.util.Collection; +import javax.xml.bind.annotation.XmlSchemaType; /** * {@link EnumLeafInfo} implementation. @@ -74,6 +76,11 @@ private QName elementName; /** + * Used to recognize token vs string. + */ + protected boolean tokenStringType; + + /** * @param clazz * @param type * clazz and type should both point to the enum class @@ -108,6 +115,20 @@ */ protected void calcConstants() { EnumConstantImpl last = null; + + // first check if we represent xs:token derived type + Collection fields = nav().getDeclaredFields(clazz); + for (F f : fields) { + if (nav().getFieldType(f).equals(String.class)) { + XmlSchemaType schemaTypeAnnotation = builder.reader.getFieldAnnotation(XmlSchemaType.class, f, this); + if (schemaTypeAnnotation != null) { + if ("token".equals(schemaTypeAnnotation.name())) { + tokenStringType = true; + break; + } + }; + } + } F[] constants = nav().getEnumConstants(clazz); for( int i=constants.length-1; i>=0; i-- ) { F constant = constants[i]; @@ -133,6 +154,14 @@ } /** + * + * @return true if enum is restriction/extension from xs:token type, otherwise false + */ + public boolean isToken() { + return tokenStringType; + } + + /** * Leaf-type cannot be referenced from IDREF. * * @deprecated @@ -168,6 +197,7 @@ return this; } + @Override public void link() { // make sure we've computed constants getConstants(); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/PropertyInfoImpl.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/PropertyInfoImpl.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/PropertyInfoImpl.java Wed Sep 28 02:14:18 2011 +0100 @@ -54,7 +54,6 @@ import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; import com.sun.xml.internal.bind.v2.runtime.Location; import com.sun.xml.internal.bind.v2.runtime.SwaRefAdapter; -import java.util.List; /** * Default partial implementation for {@link PropertyInfo}. @@ -357,27 +356,8 @@ QName typeName = parent.getTypeName(); if(typeName!=null) uri = typeName.getNamespaceURI(); - else { - if ((this.getSchemaType() == null) && ("".equals(this.getName()))) { - uri = ""; - } else { - Object upS = parent.getUpstream(); - if ((upS != null) && (upS instanceof ElementPropertyInfoImpl)) { - ElementPropertyInfoImpl info = (ElementPropertyInfoImpl)upS; - if ((info != null) && (info.getSchemaType() == null)) { - List types = info.getTypes(); - if ((types != null) && (types.size() > 0)) { - uri = ((TypeRefImpl)(types.get(0))).getTagName().getNamespaceURI(); - } else { - uri = ""; - } - break; - } - } - uri = xs.namespace(); - } - break; - } + else + uri = xs.namespace(); if(uri.length()==0) uri = parent.builder.defaultNsUri; break; diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/RuntimeEnumLeafInfoImpl.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/RuntimeEnumLeafInfoImpl.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/model/impl/RuntimeEnumLeafInfoImpl.java Wed Sep 28 02:14:18 2011 +0100 @@ -114,6 +114,7 @@ return false; } + @Override public Class getClazz() { return clazz; } @@ -135,14 +136,10 @@ B b = baseXducer.parse(lexical); - if(b instanceof String) { // issue 602 - ugly patch + if (tokenStringType) { b = (B) ((String)b).trim(); } - if(b==null) { - return null; - } - return parseMap.get(b); } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -42,7 +42,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeSet; - import javax.xml.bind.Binder; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; @@ -232,7 +231,7 @@ private WeakReference typeInfoSetCache; - private @NotNull RuntimeAnnotationReader annotaitonReader; + private @NotNull RuntimeAnnotationReader annotationReader; private /*almost final*/ boolean hasSwaRef; private final @NotNull Map subclassReplacements; @@ -256,20 +255,11 @@ return xmlNsSet; } - /** - * - * @param typeRefs - * used to build {@link Bridge}s. Can be empty. - * @param c14nSupport - * {@link #c14nSupport}. - * @param xmlAccessorFactorySupport - * Use custom com.sun.xml.internal.bind.v2.runtime.reflect.Accessor implementation. - */ - public JAXBContextImpl(JAXBContextBuilder builder) throws JAXBException { + private JAXBContextImpl(JAXBContextBuilder builder) throws JAXBException { this.defaultNsUri = builder.defaultNsUri; this.retainPropertyInfo = builder.retainPropertyInfo; - this.annotaitonReader = builder.annotationReader; + this.annotationReader = builder.annotationReader; this.subclassReplacements = builder.subclassReplacements; this.c14nSupport = builder.c14nSupport; this.classes = builder.classes; @@ -320,14 +310,12 @@ for( Entry e : typeSet.beans().entrySet() ) { ClassBeanInfoImpl bi = getOrCreate(e.getValue()); - XmlSchema xs = this.annotaitonReader.getPackageAnnotation(XmlSchema.class, e.getKey(), null); + XmlSchema xs = this.annotationReader.getPackageAnnotation(XmlSchema.class, e.getKey(), null); if(xs != null) { if(xs.xmlns() != null && xs.xmlns().length > 0) { if(xmlNsSet == null) xmlNsSet = new HashSet(); - - for(int i = 0; i < xs.xmlns().length; i++) - xmlNsSet.add(xs.xmlns()[i]); + xmlNsSet.addAll(Arrays.asList(xs.xmlns())); } } @@ -444,7 +432,7 @@ return r; } - final RuntimeModelBuilder builder = new RuntimeModelBuilder(this,annotaitonReader,subclassReplacements,defaultNsUri); + final RuntimeModelBuilder builder = new RuntimeModelBuilder(this,annotationReader,subclassReplacements,defaultNsUri); IllegalAnnotationsException.Builder errorHandler = new IllegalAnnotationsException.Builder(); builder.setErrorHandler(errorHandler); @@ -795,7 +783,7 @@ XmlJavaTypeAdapter xjta = tr.get(XmlJavaTypeAdapter.class); XmlList xl = tr.get(XmlList.class); - Ref ref = new Ref(annotaitonReader, tis.getNavigator(), tr.type, xjta, xl ); + Ref ref = new Ref(annotationReader, tis.getNavigator(), tr.type, xjta, xl ); return tis.getTypeInfo(ref); } @@ -808,11 +796,13 @@ } @Override + @SuppressWarnings("ThrowableInitCause") public void generateSchema(SchemaOutputResolver outputResolver) throws IOException { if(outputResolver==null) throw new IOException(Messages.NULL_OUTPUT_RESOLVER.format()); final SAXParseException[] e = new SAXParseException[1]; + final SAXParseException[] w = new SAXParseException[1]; createSchemaGenerator().write(outputResolver, new ErrorListener() { public void error(SAXParseException exception) { @@ -823,15 +813,23 @@ e[0] = exception; } - public void warning(SAXParseException exception) {} + public void warning(SAXParseException exception) { + w[0] = exception; + } + public void info(SAXParseException exception) {} }); - if(e[0]!=null) { + if (e[0]!=null) { IOException x = new IOException(Messages.FAILED_TO_GENERATE_SCHEMA.format()); x.initCause(e[0]); throw x; } + if (w[0]!=null) { + IOException x = new IOException(Messages.ERROR_PROCESSING_SCHEMA.format()); + x.initCause(w[0]); + throw x; + } } private XmlSchemaGenerator createSchemaGenerator() { @@ -1058,7 +1056,7 @@ this.supressAccessorWarnings = baseImpl.supressAccessorWarnings; this.retainPropertyInfo = baseImpl.retainPropertyInfo; this.defaultNsUri = baseImpl.defaultNsUri; - this.annotationReader = baseImpl.annotaitonReader; + this.annotationReader = baseImpl.annotationReader; this.subclassReplacements = baseImpl.subclassReplacements; this.c14nSupport = baseImpl.c14nSupport; this.classes = baseImpl.classes; diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java Wed Sep 28 02:14:18 2011 +0100 @@ -158,10 +158,12 @@ write(obj, createWriter(out), new StAXPostInitAction(inscopeNamespace,serializer)); } + @Override public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException { write(obj, XMLStreamWriterOutput.create(writer,context), new StAXPostInitAction(writer,serializer)); } + @Override public void marshal(Object obj, XMLEventWriter writer) throws JAXBException { write(obj, new XMLEventWriterOutput(writer), new StAXPostInitAction(writer,serializer)); } @@ -283,6 +285,7 @@ validator.setErrorHandler(new FatalAdapter(serializer)); // work around a bug in JAXP validator in Tiger XMLFilterImpl f = new XMLFilterImpl() { + @Override public void startPrefixMapping(String prefix, String uri) throws SAXException { super.startPrefixMapping(prefix.intern(), uri.intern()); } @@ -451,6 +454,7 @@ } + @Override public Object getProperty(String name) throws PropertyException { if( INDENT_STRING.equals(name) ) return indent; @@ -466,11 +470,11 @@ return c14nSupport; if ( OBJECT_IDENTITY_CYCLE_DETECTION.equals(name)) return serializer.getObjectIdentityCycleDetection(); -; return super.getProperty(name); } + @Override public void setProperty(String name, Object value) throws PropertyException { if( INDENT_STRING.equals(name) ) { checkString(name, value); @@ -575,10 +579,12 @@ return serializer.attachmentMarshaller; } + @Override public Schema getSchema() { return schema; } + @Override public void setSchema(Schema s) { this.schema = s; } @@ -591,10 +597,12 @@ return false; } + @Override public Listener getListener() { return externalListener; } + @Override public void setListener(Listener listener) { externalListener = listener; } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/Messages.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/Messages.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/Messages.java Wed Sep 28 02:14:18 2011 +0100 @@ -56,10 +56,13 @@ ELEMENT_NEEDED_BUT_FOUND_DOCUMENT, // 1 arg UNKNOWN_CLASS, // 1 arg FAILED_TO_GENERATE_SCHEMA, // 0 args + ERROR_PROCESSING_SCHEMA, // 0 args + ILLEGAL_CONTENT, // 2 args ; private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); + @Override public String toString() { return format(); } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/Messages.properties --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/Messages.properties Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/Messages.properties Wed Sep 28 02:14:18 2011 +0100 @@ -95,3 +95,9 @@ FAILED_TO_GENERATE_SCHEMA = \ Failed to generate schema. + +ERROR_PROCESSING_SCHEMA = \ + Error during schema processing. + +ILLEGAL_CONTENT = \ + Illegal XML content in <{0}>: "{1}". diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/output/UTF8XmlOutput.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/output/UTF8XmlOutput.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/output/UTF8XmlOutput.java Wed Sep 28 02:14:18 2011 +0100 @@ -122,6 +122,7 @@ } } + @Override public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { flushBuffer(); super.endDocument(fragment); @@ -145,6 +146,7 @@ writeNsDecls(base); } + @Override public void beginStartTag(Name name) throws IOException { closeStartTag(); int base = pushNsDecls(); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Base64Data.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Base64Data.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Base64Data.java Wed Sep 28 02:14:18 2011 +0100 @@ -277,6 +277,7 @@ return DatatypeConverterImpl._printBase64Binary(data, 0, dataLen); } + @Override public void writeTo(char[] buf, int start) { get(); DatatypeConverterImpl._printBase64Binary(data, 0, dataLen, buf, start); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/FastInfosetConnector.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/FastInfosetConnector.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/FastInfosetConnector.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -58,7 +58,7 @@ public FastInfosetConnector(StAXDocumentParser fastInfosetStreamReader, XmlVisitor visitor) { - super(new InterningXmlVisitor(visitor)); + super(visitor); fastInfosetStreamReader.setStringInterning(true); this.fastInfosetStreamReader = fastInfosetStreamReader; } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java Wed Sep 28 02:14:18 2011 +0100 @@ -182,7 +182,11 @@ Attributes atts = ea.atts; for (int i = 0; i < atts.getLength(); i ++){ String auri = atts.getURI(i); + // may be empty string based on parser settings String alocal = atts.getLocalName(i); + if ("".equals(alocal)) { + alocal = atts.getQName(i); + } String avalue = atts.getValue(i); TransducedAccessor xacc = attUnmarshallers.get(auri, alocal); try { diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java Wed Sep 28 02:14:18 2011 +0100 @@ -469,7 +469,6 @@ } private void _startElement(TagName tagName) throws SAXException { - // remember the current element if we are interested in it. // because the inner peer might not be found while we consume // the enter element token, we need to keep this information diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/Messages.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/Messages.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/Messages.java Wed Sep 28 02:14:18 2011 +0100 @@ -37,6 +37,7 @@ private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); + @Override public String toString() { return format(); } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/Messages.properties --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/Messages.properties Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/Messages.properties Wed Sep 28 02:14:18 2011 +0100 @@ -23,4 +23,9 @@ # questions. # -ANONYMOUS_TYPE_CYCLE=Anonymous types form an infinite cycle: {0} +ANONYMOUS_TYPE_CYCLE= Error occured during schema generation, however the schema could be generated. \ +There is a circular dependency on an element in your schema: {0} \ +This element \ +is not defined as global element and thus references were not generated and \ +the type has been inlined where possible. To allow references for the type, add \ +XmlRootElement annotation to your type definition class. diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java Wed Sep 28 02:14:18 2011 +0100 @@ -233,7 +233,7 @@ // search properties for foreign namespace references for( PropertyInfo p : clazz.getProperties()) { - n.processForeignNamespaces(p); + n.processForeignNamespaces(p, 1); if (p instanceof AttributePropertyInfo) { AttributePropertyInfo ap = (AttributePropertyInfo) p; String aUri = ap.getXmlName().getNamespaceURI(); @@ -295,7 +295,7 @@ n.elementDecls.put(name.getLocalPart(),n.new ElementWithType(nillable, elem.getContentType())); // search for foreign namespace references - n.processForeignNamespaces(elem.getProperty()); + n.processForeignNamespaces(elem.getProperty(), 1); } public void add( EnumLeafInfo envm ) { @@ -543,15 +543,19 @@ * * @param p the PropertyInfo */ - private void processForeignNamespaces(PropertyInfo p) { - // TODO: missing the correct handling of anonymous type, - // which requires recursive checks - for( TypeInfo t : p.ref()) { - if(t instanceof Element) { - addDependencyTo(((Element)t).getElementName()); + private void processForeignNamespaces(PropertyInfo p, int processingDepth) { + for (TypeInfo t : p.ref()) { + if ((t instanceof ClassInfo) && (processingDepth > 0)) { + java.util.List l = ((ClassInfo) t).getProperties(); + for (PropertyInfo subp : l) { + processForeignNamespaces(subp, --processingDepth); + } } - if(t instanceof NonElement) { - addDependencyTo(((NonElement)t).getTypeName()); + if (t instanceof Element) { + addDependencyTo(((Element) t).getElementName()); + } + if (t instanceof NonElement) { + addDependencyTo(((NonElement) t).getTypeName()); } } } @@ -560,15 +564,18 @@ // even though the Element interface says getElementName() returns non-null, // ClassInfo always implements Element (even if an instance of ClassInfo might not be an Element). // so this check is still necessary - if(qname==null) return; + if (qname==null) { + return; + } String nsUri = qname.getNamespaceURI(); - if(nsUri.equals(XML_SCHEMA)) + if (nsUri.equals(XML_SCHEMA)) { // no need to explicitly refer to XSD namespace return; + } - if(nsUri.equals(uri)) { + if (nsUri.equals(uri)) { selfReference = true; return; } @@ -1472,8 +1479,6 @@ /** - * TODO: JAX-WS dependency on this method - consider moving this method into com.sun.tools.internal.jxc.util.Util - * * Relativizes a URI by using another URI (base URI.) * *

diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexType.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexType.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexType.java Wed Sep 28 02:14:18 2011 +0100 @@ -36,17 +36,17 @@ @XmlAttribute("final") + public ComplexType _final(String value); + + @XmlAttribute("final") public ComplexType _final(String[] value); - @XmlAttribute("final") - public ComplexType _final(String value); + @XmlAttribute + public ComplexType block(String value); @XmlAttribute public ComplexType block(String[] value); - @XmlAttribute - public ComplexType block(String value); - @XmlAttribute("abstract") public ComplexType _abstract(boolean value); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Schema.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Schema.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Schema.java Wed Sep 28 02:14:18 2011 +0100 @@ -63,10 +63,10 @@ public Schema blockDefault(String[] value); @XmlAttribute - public Schema finalDefault(String[] value); + public Schema finalDefault(String value); @XmlAttribute - public Schema finalDefault(String value); + public Schema finalDefault(String[] value); @XmlAttribute public Schema version(String value); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleType.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleType.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleType.java Wed Sep 28 02:14:18 2011 +0100 @@ -36,10 +36,10 @@ @XmlAttribute("final") - public SimpleType _final(String value); + public SimpleType _final(String[] value); @XmlAttribute("final") - public SimpleType _final(String[] value); + public SimpleType _final(String value); @XmlAttribute public SimpleType name(String value); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/TopLevelElement.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/TopLevelElement.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/TopLevelElement.java Wed Sep 28 02:14:18 2011 +0100 @@ -37,10 +37,10 @@ @XmlAttribute("final") - public TopLevelElement _final(String[] value); + public TopLevelElement _final(String value); @XmlAttribute("final") - public TopLevelElement _final(String value); + public TopLevelElement _final(String[] value); @XmlAttribute("abstract") public TopLevelElement _abstract(boolean value); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Wildcard.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Wildcard.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Wildcard.java Wed Sep 28 02:14:18 2011 +0100 @@ -37,9 +37,9 @@ public Wildcard processContents(String value); @XmlAttribute - public Wildcard namespace(String value); + public Wildcard namespace(String[] value); @XmlAttribute - public Wildcard namespace(String[] value); + public Wildcard namespace(String value); } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/bind/v2/util/QNameMap.java --- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/util/QNameMap.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/util/QNameMap.java Wed Sep 28 02:14:18 2011 +0100 @@ -147,7 +147,7 @@ Entry e = getEntry(nsUri,localPart); if(e==null) return null; else return e.value; - } + } public V get( QName name ) { return get(name.getNamespaceURI(),name.getLocalPart()); @@ -300,8 +300,7 @@ int i = t.length; Entry n = null; if (size != 0) { // advance to first entry - while (i > 0 && (n = t[--i]) == null) - ; + while (i > 0 && (n = t[--i]) == null) {} } next = n; index = i; @@ -383,6 +382,7 @@ return oldValue; } + @Override public boolean equals(Object o) { if (!(o instanceof Entry)) return false; @@ -401,11 +401,13 @@ return false; } + @Override public int hashCode() { return ( localName.hashCode()) ^ (value==null ? 0 : value.hashCode()); } + @Override public String toString() { return '"'+nsUri +"\",\"" +localName + "\"=" + getValue(); } @@ -429,6 +431,7 @@ public Iterator> iterator() { return newEntryIterator(); } + @Override public boolean contains(Object o) { if (!(o instanceof Entry)) return false; @@ -436,6 +439,7 @@ Entry candidate = getEntry(e.nsUri,e.localName); return candidate != null && candidate.equals(e); } + @Override public boolean remove(Object o) { throw new UnsupportedOperationException(); } @@ -457,6 +461,7 @@ return e; } + @Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append('{'); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/ws/api/WSFeatureList.java --- a/sources/jaxws_src/src/com/sun/xml/internal/ws/api/WSFeatureList.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/ws/api/WSFeatureList.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -57,4 +57,28 @@ * Obtains all the features in the array. */ @NotNull WebServiceFeature[] toArray(); + + /** + * Merges the extra features that are not already set on binding. + * i.e, if a feature is set already on binding through someother API + * the coresponding wsdlFeature is not set. + * + * @param features Web Service features that need to be merged with already configured features. + * @param reportConflicts If true, checks if the feature setting in WSDL (wsdl extension or + * policy configuration) colflicts with feature setting in Deployed Service and + * logs warning if there are any conflicts. + */ + void mergeFeatures(@NotNull WebServiceFeature[] features, boolean reportConflicts); + + /** + * Merges the extra features that are not already set on binding. + * i.e, if a feature is set already on binding through someother API + * the coresponding wsdlFeature is not set. + * + * @param features Web Service features that need to be merged with already configured features. + * @param reportConflicts If true, checks if the feature setting in WSDL (wsdl extension or + * policy configuration) colflicts with feature setting in Deployed Service and + * logs warning if there are any conflicts. + */ + void mergeFeatures(@NotNull Iterable features, boolean reportConflicts); } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java --- a/sources/jaxws_src/src/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -273,6 +273,19 @@ } } + public void mergeFeatures(WebServiceFeature[] features, boolean reportConflicts) { + for (WebServiceFeature wsdlFtr : features) { + if (get(wsdlFtr.getClass()) == null) { + add(wsdlFtr); + } else if (reportConflicts) { + if (isEnabled(wsdlFtr.getClass()) != wsdlFtr.isEnabled()) { + LOGGER.warning(ModelerMessages.RUNTIME_MODELER_FEATURE_CONFLICT( + get(wsdlFtr.getClass()), wsdlFtr)); + } + } + } + } + /** * Set the parent features. Basically the parent feature list will be overriden * by this feature list. diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/ws/developer/HttpConfigFeature.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sources/jaxws_src/src/com/sun/xml/internal/ws/developer/HttpConfigFeature.java Wed Sep 28 02:14:18 2011 +0100 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 1997, 2011, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.xml.internal.ws.developer; + +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; +import java.lang.reflect.Constructor; +import java.net.CookieHandler; + +/** + * A proxy's HTTP configuration (e.g cookie handling) can be configured using + * this feature. While creating the proxy, this can be passed just like other + * features. + * + *

+ * THIS feature IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE. + * + * @author Jitendra Kotamraju + */ +public final class HttpConfigFeature extends WebServiceFeature { + /** + * Constant value identifying the {@link @HttpConfigFeature} feature. + */ + public static final String ID = "http://jax-ws.java.net/features/http-config"; + + private static final Constructor cookieManagerConstructor; + private static final Object cookiePolicy; + static { + Constructor tempConstructor; + Object tempPolicy; + try { + /* + * Using reflection to create CookieManger so that RI would continue to + * work with JDK 5. + */ + Class policyClass = Class.forName("java.net.CookiePolicy"); + Class storeClass = Class.forName("java.net.CookieStore"); + tempConstructor = Class.forName("java.net.CookieManager").getConstructor(storeClass, policyClass); + // JDK's default policy is ACCEPT_ORIGINAL_SERVER, but ACCEPT_ALL + // is used for backward compatibility + tempPolicy = policyClass.getField("ACCEPT_ALL").get(null); + } catch(Exception e) { + try { + /* + * Using reflection so that these classes won't have to be + * integrated in JDK 6. + */ + Class policyClass = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookiePolicy"); + Class storeClass = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookieStore"); + tempConstructor = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookieManager").getConstructor(storeClass, policyClass); + // JDK's default policy is ACCEPT_ORIGINAL_SERVER, but ACCEPT_ALL + // is used for backward compatibility + tempPolicy = policyClass.getField("ACCEPT_ALL").get(null); + } catch(Exception ce) { + throw new WebServiceException(ce); + } + } + cookieManagerConstructor = tempConstructor; + cookiePolicy = tempPolicy; + } + + private final CookieHandler cookieJar; // shared object among the tubes + + public HttpConfigFeature() { + this(getInternalCookieHandler()); + } + + public HttpConfigFeature(CookieHandler cookieJar) { + this.enabled = true; + this.cookieJar = cookieJar; + } + + private static CookieHandler getInternalCookieHandler() { + try { + return (CookieHandler)cookieManagerConstructor.newInstance(null, cookiePolicy); + } catch(Exception e) { + throw new WebServiceException(e); + } + } + + public String getID() { + return ID; + } + + public CookieHandler getCookieHandler() { + return cookieJar; + } + +} diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/ws/transport/DeferredTransportPipe.java --- a/sources/jaxws_src/src/com/sun/xml/internal/ws/transport/DeferredTransportPipe.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/ws/transport/DeferredTransportPipe.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -30,8 +30,10 @@ import com.sun.xml.internal.ws.api.pipe.*; import com.sun.xml.internal.ws.api.pipe.helper.AbstractTubeImpl; import com.sun.istack.internal.NotNull; +import com.sun.xml.internal.ws.developer.HttpConfigFeature; import javax.xml.ws.BindingProvider; +import javax.xml.ws.WebServiceFeature; /** * Proxy transport {@link Tube} and {@link Pipe} that lazily determines the @@ -58,14 +60,13 @@ private final ClassLoader classLoader; private final ClientTubeAssemblerContext context; - public DeferredTransportPipe(ClassLoader classLoader, ClientPipeAssemblerContext context) { - this(classLoader, new ClientTubeAssemblerContext(context.getAddress(), context.getWsdlModel(), - context.getBindingProvider(), context.getBinding(), context.getContainer(), context.getCodec(), context.getSEIModel())); - } - public DeferredTransportPipe(ClassLoader classLoader, ClientTubeAssemblerContext context) { this.classLoader = classLoader; this.context = context; + if (context.getBinding().getFeature(HttpConfigFeature.class) == null) { + context.getBinding().getFeatures().mergeFeatures( + new WebServiceFeature[] { new HttpConfigFeature() }, false); + } //See if we can create the transport pipe from the available information. try { this.transport = TransportTubeFactory.create(classLoader, context); @@ -80,7 +81,7 @@ this.classLoader = that.classLoader; this.context = that.context; if(that.transport!=null) { - this.transport = ((PipeCloner)cloner).copy(that.transport); + this.transport = cloner.copy(that.transport); this.address = that.address; } } @@ -136,19 +137,5 @@ public DeferredTransportPipe copy(TubeCloner cloner) { return new DeferredTransportPipe(this,cloner); - /* - DeferredTransportPipe copy = new DeferredTransportPipe(classLoader,context); - cloner.add(this,copy); - - // TODO Is the following thread-safe ?? - // copied pipeline is still likely to work with the same endpoint address, - // so also copy the cached transport pipe, if any - if(transport!=null) { - copy.transport = cloner.copy(this.transport); - copy.address = this.address; - } - - return copy; - */ } } diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/ws/transport/http/client/HttpTransportPipe.java --- a/sources/jaxws_src/src/com/sun/xml/internal/ws/transport/http/client/HttpTransportPipe.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/ws/transport/http/client/HttpTransportPipe.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -32,6 +32,7 @@ import com.sun.xml.internal.ws.api.message.Packet; import com.sun.xml.internal.ws.api.pipe.*; import com.sun.xml.internal.ws.api.pipe.helper.AbstractTubeImpl; +import com.sun.xml.internal.ws.developer.HttpConfigFeature; import com.sun.xml.internal.ws.transport.Headers; import com.sun.xml.internal.ws.util.ByteArrayBuffer; import com.sun.xml.internal.ws.client.ClientTransportException; @@ -50,7 +51,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.lang.reflect.Constructor; import java.net.CookieHandler; import java.util.Collections; import java.util.List; @@ -74,42 +74,6 @@ private final CookieHandler cookieJar; // shared object among the tubes private final boolean sticky; - private static final Constructor cookieManagerConstructor; - private static final Object cookiePolicy; - static { - Constructor tempConstructor; - Object tempPolicy; - try { - /* - * Using reflection to create CookieManger so that RI would continue to - * work with JDK 5. - */ - Class policyClass = Class.forName("java.net.CookiePolicy"); - Class storeClass = Class.forName("java.net.CookieStore"); - tempConstructor = Class.forName("java.net.CookieManager").getConstructor(storeClass, policyClass); - // JDK's default policy is ACCEPT_ORIGINAL_SERVER, but ACCEPT_ALL - // is used for backward compatibility - tempPolicy = policyClass.getField("ACCEPT_ALL").get(null); - } catch(Exception e) { - try { - /* - * Using reflection so that these classes won't have to be - * integrated in JDK 6. - */ - Class policyClass = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookiePolicy"); - Class storeClass = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookieStore"); - tempConstructor = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookieManager").getConstructor(storeClass, policyClass); - // JDK's default policy is ACCEPT_ORIGINAL_SERVER, but ACCEPT_ALL - // is used for backward compatibility - tempPolicy = policyClass.getField("ACCEPT_ALL").get(null); - } catch(Exception ce) { - throw new WebServiceException(ce); - } - } - cookieManagerConstructor = tempConstructor; - cookiePolicy = tempPolicy; - } - // Need to use JAXB first to register DatatypeConverter static { try { @@ -119,26 +83,15 @@ } } - private static CookieHandler getCookieHandler() { - try { - return (CookieHandler)cookieManagerConstructor.newInstance(null, cookiePolicy); - } catch(Exception e) { - throw new WebServiceException(e); - } - } - public HttpTransportPipe(Codec codec, WSBinding binding) { - // TODO Rather than creating a new instance, CookieJar should be got - // TODO from a feature ideally. That way CookieJar can be shared across - // TODO multiple proxies - this(codec, binding, getCookieHandler(), isSticky(binding)); - } - - private HttpTransportPipe(Codec codec, WSBinding binding, CookieHandler cookieJar, boolean sticky) { this.codec = codec; this.binding = binding; - this.sticky = sticky; - this.cookieJar = cookieJar; + this.sticky = isSticky(binding); + HttpConfigFeature configFeature = binding.getFeature(HttpConfigFeature.class); + if (configFeature == null) { + configFeature = new HttpConfigFeature(); + } + this.cookieJar = configFeature.getCookieHandler(); } private static boolean isSticky(WSBinding binding) { @@ -157,7 +110,7 @@ * Copy constructor for {@link Tube#copy(TubeCloner)}. */ private HttpTransportPipe(HttpTransportPipe that, TubeCloner cloner) { - this(that.codec.copy(), that.binding, that.cookieJar, that.sticky); + this(that.codec.copy(), that.binding); cloner.add(that,this); } @@ -358,8 +311,14 @@ } if (sticky || (shouldMaintainSessionProperty != null && shouldMaintainSessionProperty)) { Map> cookies = cookieJar.get(context.endpointAddress.getURI(),reqHeaders); - reqHeaders.putAll(cookies); - //cookieJar.applyRelevantCookies(context.endpointAddress.getURL(), reqHeaders); + List cookieList = cookies.get("Cookie"); + if (cookieList != null && !cookieList.isEmpty()) { + reqHeaders.put("Cookie", cookieList); + } + cookieList = cookies.get("Cookie2"); + if (cookieList != null && !cookieList.isEmpty()) { + reqHeaders.put("Cookie2", cookieList); + } } } @@ -413,15 +372,7 @@ private void dump(ByteArrayBuffer buf, String caption, Map> headers) throws IOException { System.out.println("---["+caption +"]---"); for (Entry> header : headers.entrySet()) { - if(header.getValue().isEmpty()) { - // I don't think this is legal, but let's just dump it, - // as the point of the dump is to uncover problems. - System.out.println(header.getValue()); - } else { - for (String value : header.getValue()) { - System.out.println(header.getKey()+": "+value); - } - } + System.out.println(header.getKey()+": "+header.getValue()); } buf.writeTo(System.out); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java --- a/sources/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -80,7 +80,8 @@ state = servers.get(inetAddress); if (state == null) { logger.fine("Creating new HTTP Server at "+inetAddress); - server = HttpServer.create(inetAddress, 5); + // Creates server with default socket backlog + server = HttpServer.create(inetAddress, 0); server.setExecutor(Executors.newCachedThreadPool()); String path = url.toURI().getPath(); logger.fine("Creating HTTP Context at = "+path); diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/com/sun/xml/internal/xsom/impl/util/Uri.java --- a/sources/jaxws_src/src/com/sun/xml/internal/xsom/impl/util/Uri.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/com/sun/xml/internal/xsom/impl/util/Uri.java Wed Sep 28 02:14:18 2011 +0100 @@ -1,28 +1,3 @@ -/* - * Copyright (c) 2001, 2010, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - /* Copyright (c) 2001, 2002 Thai Open Source Software Center Ltd All rights reserved. diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/javax/xml/bind/JAXBContext.java --- a/sources/jaxws_src/src/javax/xml/bind/JAXBContext.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/javax/xml/bind/JAXBContext.java Wed Sep 28 02:14:18 2011 +0100 @@ -50,7 +50,7 @@ * separated Java package names. Each java package contains * JAXB mapped classes, schema-derived classes and/or user annotated * classes. Additionally, the java package may contain JAXB package annotations - * that must be processed. (see JLS 3rd Edition, Section 7.4.1. Package Annotations). + * that must be processed. (see JLS, Section 7.4.1 "Named Packages"). * *

  • {@link #newInstance(Class...) JAXBContext.newInstance( com.acme.foo.Foo.class )}
    * The JAXBContext instance is intialized with class(es) @@ -256,7 +256,7 @@ * @author
    • Ryan Shoemaker, Sun Microsystems, Inc.
    • Kohsuke Kawaguchi, Sun Microsystems, Inc.
    • Joe Fialli, Sun Microsystems, Inc.
    * @see Marshaller * @see Unmarshaller - * @see S 7.4.1.1 "Package Annotations" in Java Language Specification, 3rd Edition + * @see S 7.4.1 "Named Packages" in Java Language Specification * @since JAXB1.0 */ public abstract class JAXBContext { @@ -314,8 +314,8 @@ * jaxb.index resource file, format described below. * Note that a java package can contain both schema-derived classes and * user annotated JAXB classes. Additionally, the java package may - * contain JAXB package annotations that must be processed. (see JLS 3rd Edition, - * Section 7.4.1. "Package Annotations"). + * contain JAXB package annotations that must be processed. (see JLS, + * Section 7.4.1 "Named Packages"). *

    * *

    @@ -548,7 +548,7 @@ *

    * Note that for each java package registered with JAXBContext, * when the optional package annotations exist, they must be processed. - * (see JLS 3rd Edition, Section 7.4.1. "Package Annotations"). + * (see JLS, Section 7.4.1 "Named Packages"). * *

    * The steps involved in discovering the JAXB implementation is discussed in the class javadoc. diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/javax/xml/bind/annotation/XmlElements.java --- a/sources/jaxws_src/src/javax/xml/bind/annotation/XmlElements.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/javax/xml/bind/annotation/XmlElements.java Wed Sep 28 02:14:18 2011 +0100 @@ -85,8 +85,8 @@ * <!-- XML Representation for a List of {1,2.5} * XML output is not wrapped using another element --> * ... - * 1 - * 2.5 + * <A> 1 </A> + * <B> 2.5 </B> * ... * * <!-- XML Schema fragment --> diff -r 5d45300e33bb -r 1a5e2ee2e853 sources/jaxws_src/src/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java --- a/sources/jaxws_src/src/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java Wed Sep 28 01:59:37 2011 +0100 +++ b/sources/jaxws_src/src/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java Wed Sep 28 02:14:18 2011 +0100 @@ -31,10 +31,10 @@ * {@link XmlAdapter} to handle xs:normalizedString. * *

    - * This adapter removes leading and trailing whitespaces, then replace - * any tab, CR, and LF by a whitespace character ' '. + * Replaces any tab, CR, and LF by a whitespace character ' ', + * as specified in the whitespace facet 'replace' * - * @author Kohsuke Kawaguchi + * @author Kohsuke Kawaguchi, Martin Grebac * @since JAXB 2.0 */ public final class NormalizedStringAdapter extends XmlAdapter {