--- old/src/share/jaxws_classes/com/sun/codemodel/internal/JDefinedClass.java 2014-03-28 17:28:07.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/codemodel/internal/JDefinedClass.java 2014-03-28 17:28:07.000000000 +0100 @@ -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 @@ -71,6 +71,9 @@ /** Static initializer, if this class has one */ private JBlock init = null; + /** Instance initializer, if this class has one */ + private JBlock instanceInit = null; + /** class javadoc */ private JDocComment jdoc = null; @@ -518,6 +521,18 @@ } /** + * Creates, if necessary, and returns the instance initializer + * for this class. + * + * @return JBlock containing initialization statements for this class + */ + public JBlock instanceInit() { + if (instanceInit == null) + instanceInit = new JBlock(); + return instanceInit; + } + + /** * Adds a constructor to this class. * * @param mods @@ -793,6 +808,8 @@ f.d(field); if (init != null) f.nl().p("static").s(init); + if (instanceInit != null) + f.nl().s(instanceInit); for (JMethod m : constructors) { f.nl().d(m); } --- old/src/share/jaxws_classes/com/sun/codemodel/internal/util/EncoderFactory.java 2014-03-28 17:28:08.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/codemodel/internal/util/EncoderFactory.java 2014-03-28 17:28:08.000000000 +0100 @@ -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 @@ -28,46 +28,20 @@ */ package com.sun.codemodel.internal.util; -import java.lang.reflect.Constructor; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; /** * Creates {@link CharsetEncoder} from a charset name. * - * Fixes a MS1252 handling bug in JDK1.4.2. - * * @author * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) */ public class EncoderFactory { - public static CharsetEncoder createEncoder( String encodin ) { + public static CharsetEncoder createEncoder( String encodin ) { Charset cs = Charset.forName(System.getProperty("file.encoding")); CharsetEncoder encoder = cs.newEncoder(); - - if( cs.getClass().getName().equals("sun.nio.cs.MS1252") ) { - try { - // at least JDK1.4.2_01 has a bug in MS1252 encoder. - // specifically, it returns true for any character. - // return a correct encoder to workaround this problem - - // statically binding to MS1252Encoder will cause a Link error - // (at least in IBM JDK1.4.1) - @SuppressWarnings("unchecked") - Class ms1252encoder = (Class) Class.forName("com.sun.codemodel.internal.util.MS1252Encoder"); - Constructor c = ms1252encoder.getConstructor(new Class[]{ - Charset.class - }); - return c.newInstance(new Object[]{cs}); - } catch( Throwable t ) { - // if something funny happens, ignore it and fall back to - // a broken MS1252 encoder. It's probably still better - // than choking here. - return encoder; - } - } - return encoder; } } --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties 2014-03-28 17:28:08.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties 2014-03-28 17:28:08.000000000 +0100 @@ -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 @@ -30,10 +30,10 @@ Non-existent directory: {0} VERSION = \ - schemagen 2.2.8-b130911.1802 + schemagen 2.2.9-b140218.1920 FULLVERSION = \ - schemagen full version "2.2.8-b130911.1802" + schemagen full version "2.2.9-b140218.1920" USAGE = \ Usage: schemagen [-options ...] \n\ --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties 2014-03-28 17:28:09.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties 2014-03-28 17:28:09.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0} -VERSION = schemagen 2.2.8-b130911.1802 +VERSION = schemagen 2.2.9-b140218.1920 -FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.8-b130911.1802" +FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.9-b140218.1920" USAGE = Verwendung: schemagen [-options ...] \nOptionen: \n\\ \\ \\ \\ -d : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help : Zeigt diese Verwendungsmeldung an --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties 2014-03-28 17:28:09.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties 2014-03-28 17:28:09.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = Directorio no existente: {0} -VERSION = schemagen 2.2.8-b130911.1802 +VERSION = schemagen 2.2.9-b140218.1920 -FULLVERSION = versi\u00F3n completa de schemagen "2.2.8-b130911.1802" +FULLVERSION = versi\u00F3n completa de schemagen "2.2.9-b140218.1920" USAGE = Sintaxis: schemagen [-options ...] \nOpciones: \n\\ \\ \\ \\ -d : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help : muestra este mensaje de sintaxis --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties 2014-03-28 17:28:10.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties 2014-03-28 17:28:10.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant -VERSION = schemagen 2.2.8-b130911.1802 +VERSION = schemagen 2.2.9-b140218.1920 -FULLVERSION = version compl\u00E8te de schemagen "2.2.8-b130911.1802" +FULLVERSION = version compl\u00E8te de schemagen "2.2.9-b140218.1920" USAGE = Syntaxe : schemagen [-options ...] \nOptions : \n\ \ \ \ -d : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties 2014-03-28 17:28:10.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties 2014-03-28 17:28:10.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = Directory non esistente: {0} -VERSION = schemagen 2.2.8-b130911.1802 +VERSION = schemagen 2.2.9-b140218.1920 -FULLVERSION = versione completa schemagen "2.2.8-b130911.1802" +FULLVERSION = versione completa schemagen "2.2.9-b140218.1920" USAGE = Uso: schemagen [-options ...] \nOpzioni: \n\ \ \ \ -d : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode : genera il file di episodio per la compilazione separata\n\ \ \ \ -version : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion : visualizza le informazioni sulla versione completa\n\ \ \ \ -help : visualizza questo messaggio sull'uso --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties 2014-03-28 17:28:10.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties 2014-03-28 17:28:10.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0} -VERSION = schemagen 2.2.8-b130911.1802 +VERSION = schemagen 2.2.9-b140218.1920 -FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.8-b130911.1802" +FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.9-b140218.1920" USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059 --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties 2014-03-28 17:28:11.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties 2014-03-28 17:28:11.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0} -VERSION = schemagen 2.2.8-b130911.1802 +VERSION = schemagen 2.2.9-b140218.1920 -FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.8-b130911.1802" +FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.9-b140218.1920" USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] \n\uC635\uC158: \n\ \ \ \ -d : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4. --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties 2014-03-28 17:28:11.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties 2014-03-28 17:28:11.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0} -VERSION = gera\u00E7\u00E3o do esquema 2.2.8-b130911.1802 +VERSION = gera\u00E7\u00E3o do esquema 2.2.9-b140218.1920 -FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.8-b130911.1802" +FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.9-b140218.1920" USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help : exibir esta mensagem de uso --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties 2014-03-28 17:28:12.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties 2014-03-28 17:28:12.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0} -VERSION = schemagen 2.2.8-b130911.1802 +VERSION = schemagen 2.2.9-b140218.1920 -FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802" +FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920" USAGE = \u7528\u6CD5: schemagen [-options ...] \n\u9009\u9879: \n\ \ \ \ -d : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F --- old/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties 2014-03-28 17:28:12.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties 2014-03-28 17:28:12.000000000 +0100 @@ -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 @@ -27,8 +27,8 @@ BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0} -VERSION = schemagen 2.2.8-b130911.1802 +VERSION = schemagen 2.2.9-b140218.1920 -FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802" +FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920" USAGE = \u7528\u6CD5: schemagen [-options ...] \n\u9078\u9805: \n\\ \\ \\ \\ -d : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F --- old/src/share/jaxws_classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceVisitor.java 2014-03-28 17:28:13.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceVisitor.java 2014-03-28 17:28:13.000000000 +0100 @@ -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 @@ -31,7 +31,6 @@ import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; import com.sun.xml.internal.ws.model.RuntimeModeler; -import javax.annotation.processing.ProcessingEnvironment; import javax.jws.Oneway; import javax.jws.WebMethod; import javax.jws.WebParam; @@ -609,12 +608,6 @@ } protected boolean isLegalSei(TypeElement interfaceElement) { - for (VariableElement field : ElementFilter.fieldsIn(interfaceElement.getEnclosedElements())) - if (field.getConstantValue() != null) { - builder.processError(WebserviceapMessages.WEBSERVICEAP_SEI_CANNOT_CONTAIN_CONSTANT_VALUES( - interfaceElement.getQualifiedName(), field.getSimpleName())); - return false; - } return methodsAreLegal(interfaceElement); } --- old/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties 2014-03-28 17:28:13.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties 2014-03-28 17:28:13.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 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 @@ -23,7 +23,7 @@ # questions. # -build-id=2.2.9-b130926.1035 -build-version=JAX-WS RI 2.2.9-b130926.1035 -major-version=2.2.9 -svn-revision=8c29a9a53251ff741fca1664a8221dc876b2eac8 +build-id=2.2.10-b140228.1436 +build-version=JAX-WS RI 2.2.10-b140228.1436 +major-version=2.2.10 +svn-revision=e1d4708e8a2aee1ae9d38313452e14ce4b67851a --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties 2014-03-28 17:28:13.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties 2014-03-28 17:28:13.000000000 +0100 @@ -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 @@ -171,20 +171,20 @@ Driver.FailedToGenerateCode = \ Failed to produce code. -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn Driver.FilePrologComment = \ - This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 \n\ + This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 \n\ See http://java.sun.com/xml/jaxb \n\ Any modifications to this file will be lost upon recompilation of the source schema. \n\ Generated on: {0} \n Driver.Version = \ - xjc 2.2.8-b130911.1802 + xjc 2.2.9-b140218.1920 Driver.FullVersion = \ - xjc full version "2.2.8-b130911.1802" + xjc full version "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties 2014-03-28 17:28:14.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties 2014-03-28 17:28:14.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden. -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert \nSiehe http://java.sun.com/xml/jaxb \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 generiert \nSiehe http://java.sun.com/xml/jaxb \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n -Driver.Version = xjc 2.2.8-b130911.1802 +Driver.Version = xjc 2.2.9-b140218.1920 -Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.8-b130911.1802" +Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties 2014-03-28 17:28:14.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties 2014-03-28 17:28:14.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo. -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.8-b130911.1802 \nVisite http://java.sun.com/xml/jaxb \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.9-b140218.1920 \nVisite http://java.sun.com/xml/jaxb \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n -Driver.Version = xjc 2.2.8-b130911.1802 +Driver.Version = xjc 2.2.9-b140218.1920 -Driver.FullVersion = versi\u00F3n completa de xjc "2.2.8-b130911.1802" +Driver.FullVersion = versi\u00F3n completa de xjc "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties 2014-03-28 17:28:15.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties 2014-03-28 17:28:15.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = Echec de la production du code. -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 \nVoir http://java.sun.com/xml/jaxb \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.9-b140218.1920 \nVoir http://java.sun.com/xml/jaxb \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n -Driver.Version = xjc 2.2.8-b130911.1802 +Driver.Version = xjc 2.2.9-b140218.1920 -Driver.FullVersion = version compl\u00E8te xjc "2.2.8-b130911.1802" +Driver.FullVersion = version compl\u00E8te xjc "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties 2014-03-28 17:28:15.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties 2014-03-28 17:28:15.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = Produzione del codice non riuscita. -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b130911.1802 \nVedere http://java.sun.com/xml/jaxb \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.9-b140218.1920 \nVedere http://java.sun.com/xml/jaxb \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n -Driver.Version = xjc 2.2.8-b130911.1802 +Driver.Version = xjc 2.2.9-b140218.1920 -Driver.FullVersion = versione completa xjc "2.2.8-b130911.1802" +Driver.FullVersion = versione completa xjc "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties 2014-03-28 17:28:16.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties 2014-03-28 17:28:16.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002 -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.8-b130911.1802\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \nhttp://java.sun.com/xml/jaxb\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.9-b140218.1920\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \nhttp://java.sun.com/xml/jaxb\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n -Driver.Version = xjc 2.2.8-b130911.1802 +Driver.Version = xjc 2.2.9-b140218.1920 -Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.8-b130911.1802" +Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties 2014-03-28 17:28:16.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties 2014-03-28 17:28:16.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.8-b130911.1802 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \nhttp://java.sun.com/xml/jaxb\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.9-b140218.1920 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \nhttp://java.sun.com/xml/jaxb\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n -Driver.Version = XJC 2.2.8-b130911.1802 +Driver.Version = XJC 2.2.9-b140218.1920 -Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.8-b130911.1802" +Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties 2014-03-28 17:28:17.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties 2014-03-28 17:28:16.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo. -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.8-b130911.1802 \nConsulte http://java.sun.com/xml/jaxb \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.9-b140218.1920 \nConsulte http://java.sun.com/xml/jaxb \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n -Driver.Version = xjc 2.2.8-b130911.1802 +Driver.Version = xjc 2.2.9-b140218.1920 -Driver.FullVersion = vers\u00E3o completa de xjc "2.2.8-b130911.1802" +Driver.FullVersion = vers\u00E3o completa de xjc "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties 2014-03-28 17:28:17.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties 2014-03-28 17:28:17.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002 -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.8-b130911.1802 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee http://java.sun.com/xml/jaxb \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.9-b140218.1920 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee http://java.sun.com/xml/jaxb \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n -Driver.Version = xjc 2.2.8-b130911.1802 +Driver.Version = xjc 2.2.9-b140218.1920 -Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802" +Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties 2014-03-28 17:28:17.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties 2014-03-28 17:28:17.000000000 +0100 @@ -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 @@ -96,14 +96,14 @@ Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc. -# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn -Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 http://java.sun.com/xml/jaxb \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n +# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn +Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 http://java.sun.com/xml/jaxb \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n -Driver.Version = xjc 2.2.8-b130911.1802 +Driver.Version = xjc 2.2.9-b140218.1920 -Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802" +Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920" -Driver.BuildID = 2.2.8-b130911.1802 +Driver.BuildID = 2.2.9-b140218.1920 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ --- old/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/BIProperty.java 2014-03-28 17:28:18.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/BIProperty.java 2014-03-28 17:28:18.000000000 +0100 @@ -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 @@ -468,25 +468,22 @@ r = ct.get(getBuilder().model); } else { FieldRendererFactory frf = getBuilder().fieldRendererFactory; - - if(prop.isOptionalPrimitive()) { + // according to the spec we should bahave as in jaxb1. So we ignore possiblity that property could be nullable + switch(opm) { // the property type can be primitive type if we are to ignore absence - switch(opm) { case PRIMITIVE: r = frf.getRequiredUnboxed(); break; case WRAPPER: // force the wrapper type - r = frf.getSingle(); + r = prop.isOptionalPrimitive() ? frf.getSingle() : frf.getDefault(); break; case ISSET: - r = frf.getSinglePrimitiveAccess(); + r = prop.isOptionalPrimitive() ? frf.getSinglePrimitiveAccess() : frf.getDefault(); break; default: throw new Error(); - } - } else { - r = frf.getDefault(); + } } if(opm==OptionalPropertyMode.ISSET) { --- old/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java 2014-03-28 17:28:19.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java 2014-03-28 17:28:19.000000000 +0100 @@ -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 @@ -91,6 +91,9 @@ import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; import com.sun.xml.internal.bind.v2.util.ByteArrayOutputStreamEx; import com.sun.xml.internal.bind.v2.util.DataSourceSource; +import java.util.logging.Logger; +import com.sun.xml.internal.bind.Util; +import java.util.logging.Level; import org.xml.sax.SAXException; @@ -105,6 +108,8 @@ public abstract class RuntimeBuiltinLeafInfoImpl extends BuiltinLeafInfoImpl implements RuntimeBuiltinLeafInfo, Transducer { + private static final Logger logger = Util.getClassLogger(); + private RuntimeBuiltinLeafInfoImpl(Class type, QName... typeNames) { super(type, typeNames); LEAVES.put(type,this); @@ -196,6 +201,7 @@ public static final List> builtinBeanInfos; public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri"; + public static final String USE_OLD_GMONTH_MAPPING = "jaxb.ri.useOldGmonthMapping"; static { @@ -960,7 +966,14 @@ m.put(DatatypeConstants.DATETIME, "%Y-%M-%DT%h:%m:%s"+ "%z"); m.put(DatatypeConstants.DATE, "%Y-%M-%D" +"%z"); m.put(DatatypeConstants.TIME, "%h:%m:%s"+ "%z"); - m.put(DatatypeConstants.GMONTH, "--%M--%z"); + if (System.getProperty(USE_OLD_GMONTH_MAPPING) == null) { + m.put(DatatypeConstants.GMONTH, "--%M%z"); // E2-12 Error. http://www.w3.org/2001/05/xmlschema-errata#e2-12 + } else { // backw. compatibility + if (logger.isLoggable(Level.FINE)) { + logger.log(Level.FINE, "Old GMonth mapping used."); + } + m.put(DatatypeConstants.GMONTH, "--%M--%z"); + } m.put(DatatypeConstants.GDAY, "---%D" + "%z"); m.put(DatatypeConstants.GYEAR, "%Y" + "%z"); m.put(DatatypeConstants.GYEARMONTH, "%Y-%M" + "%z"); --- old/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/Navigator.java 2014-03-28 17:28:19.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/Navigator.java 2014-03-28 17:28:19.000000000 +0100 @@ -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 @@ -25,10 +25,6 @@ package com.sun.xml.internal.bind.v2.model.nav; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.lang.reflect.Type; import java.util.Collection; import com.sun.xml.internal.bind.v2.runtime.Location; --- old/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java 2014-03-28 17:28:20.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java 2014-03-28 17:28:19.000000000 +0100 @@ -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 @@ -550,7 +550,7 @@ @Override public Class loadObjectFactory(Class referencePoint, String pkg) { - ClassLoader cl= SecureLoader.getClassClassLoader(referencePoint); + ClassLoader cl = SecureLoader.getClassClassLoader(referencePoint); if (cl == null) cl = SecureLoader.getSystemClassLoader(); --- old/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java 2014-03-28 17:28:20.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java 2014-03-28 17:28:20.000000000 +0100 @@ -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 @@ -140,22 +140,23 @@ */ private final Loader itemsLoader = new Loader(false) { - private ThreadLocal target = new ThreadLocal(); - private ThreadLocal map = new ThreadLocal(); - private int depthCounter = 0; // needed to clean ThreadLocals + private ThreadLocal> target = new ThreadLocal>(); + private ThreadLocal> map = new ThreadLocal>(); @Override public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { // create or obtain the Map object try { - target.set((BeanT)state.prev.target); - map.set(acc.get(target.get())); - depthCounter++; - if(map.get() == null) { - map.set(ClassFactory.create(mapImplClass)); - } - map.get().clear(); - state.target = map.get(); + BeanT target = (BeanT) state.prev.target; + ValueT mapValue = acc.get(target); + if(mapValue == null) + mapValue = ClassFactory.create(mapImplClass); + else + mapValue.clear(); + + Stack.push(this.target, target); + Stack.push(map, mapValue); + state.target = mapValue; } catch (AccessorException e) { // recover from error by setting a dummy Map that receives and discards the values handleGenericException(e,true); @@ -167,11 +168,7 @@ public void leaveElement(State state, TagName ea) throws SAXException { super.leaveElement(state, ea); try { - acc.set(target.get(), map.get()); - if (--depthCounter == 0) { - target.remove(); - map.remove(); - } + acc.set(Stack.pop(target), Stack.pop(map)); } catch (AccessorException ex) { handleGenericException(ex,true); } @@ -289,4 +286,36 @@ return acc; return null; } + + private static final class Stack { + private Stack parent; + private T value; + + private Stack(Stack parent, T value) { + this.parent = parent; + this.value = value; + } + + private Stack(T value) { + this.value = value; + } + + private static void push(ThreadLocal> holder, T value) { + Stack parent = holder.get(); + if (parent == null) + holder.set(new Stack(value)); + else + holder.set(new Stack(parent, value)); + } + + private static T pop(ThreadLocal> holder) { + Stack current = holder.get(); + if (current.parent == null) + holder.remove(); + else + holder.set(current.parent); + return current.value; + } + + } } --- old/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java 2014-03-28 17:28:20.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java 2014-03-28 17:28:20.000000000 +0100 @@ -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 @@ -1070,18 +1070,22 @@ } Collection refs = propInfo.ref(); - TypeInfo ti; - if ((refs != null) && (!refs.isEmpty()) && (elemName != null) - && ((ti = refs.iterator().next()) == null || ti instanceof ClassInfoImpl)) { - ClassInfoImpl cImpl = (ClassInfoImpl)ti; - if ((cImpl != null) && (cImpl.getElementName() != null)) { + if ((refs != null) && (!refs.isEmpty()) && (elemName != null)){ + ClassInfoImpl cImpl = null; + for (TypeInfo ref : refs) { + if (ref == null || ref instanceof ClassInfoImpl) { + if (elemName.equals(((ClassInfoImpl)ref).getElementName())) { + cImpl = (ClassInfoImpl) ref; + break; + } + } + } + if (cImpl != null) e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart())); - } else { + else e.ref(new QName("", tn.getLocalPart())); - } - } else { + } else e.ref(tn); - } } } else { e.name(tn.getLocalPart()); --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java 2014-03-28 17:28:21.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java 2014-03-28 17:28:21.000000000 +0100 @@ -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 @@ -621,7 +621,8 @@ String plain = user + ":"; byte[] nameBytes = plain.getBytes(); - byte[] passwdBytes = password.getBytes(); + byte[] passwdBytes = (password == null ? new byte[0] : password + .getBytes()); // concatenate user name and password bytes and encode them byte[] concat = new byte[nameBytes.length + passwdBytes.length]; --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/MessagingException.java 2014-03-28 17:28:21.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/MessagingException.java 2014-03-28 17:28:21.000000000 +0100 @@ -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 @@ -84,7 +84,7 @@ * * @return next Exception, null if none. */ - public Exception getNextException() { + public synchronized Exception getNextException() { return next; } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/BMMimeMultipart.java 2014-03-28 17:28:22.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/BMMimeMultipart.java 2014-03-28 17:28:22.000000000 +0100 @@ -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 @@ -40,7 +40,6 @@ import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*; import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; -import com.sun.xml.internal.messaging.saaj.util.FinalArrayList; /** * The MimeMultipart class is an implementation of the abstract Multipart @@ -393,13 +392,12 @@ int i; int l = pattern.length; int lx = l -1; - int bufferLength = 0; BitSet eof = new BitSet(1); long[] posVector = new long[1]; while (true) { is.mark(l); - bufferLength = readNext(is, buffer, l, eof, posVector, sin); + readNext(is, buffer, l, eof, posVector, sin); if (eof.get(0)) { // End of stream return false; @@ -561,7 +559,7 @@ if (prevBuffer[s-1] == (byte)13) { // if buffer[0] == (byte)10 if (buffer[0] == (byte)10) { - int j=lx-1; + int j; for(j = lx-1; j > 0; j--) { if (buffer[j+1] != pattern[j]) { break; @@ -695,7 +693,6 @@ * Iterates through all the parts and outputs each Mime part * separated by a boundary. */ - byte[] buf = new byte[1024]; public void writeTo(OutputStream os) throws IOException, MessagingException { @@ -715,19 +712,25 @@ if (in != null) { OutputUtil.writeln(bnd, os); // put out boundary if ((os instanceof ByteOutputStream) && lazyAttachments) { - ((ByteOutputStream)os).write(in); + ((ByteOutputStream) os).write(in); } else { - ByteOutputStream baos = new ByteOutputStream(in.available()); - baos.write(in); - baos.writeTo(os); - // reset the inputstream so that we can support a - //getAttachment later - in = baos.newInputStream(); + ByteOutputStream baos = null; + try { + baos = new ByteOutputStream(in.available()); + baos.write(in); + baos.writeTo(os); + // reset the inputstream so that we can support a + // getAttachment later + in = baos.newInputStream(); + } finally { + if (baos != null) + baos.close(); + } } // this will endup writing the end boundary } else { - // put out last boundary + // put out last boundary OutputUtil.writeAsAscii(bnd, os); OutputUtil.writeAsAscii("--", os); } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeBodyPart.java 2014-03-28 17:28:22.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeBodyPart.java 2014-03-28 17:28:22.000000000 +0100 @@ -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 @@ -193,13 +193,17 @@ SharedInputStream sis = (SharedInputStream) is; contentStream = sis.newStream(sis.getPosition(), -1); } else { + ByteOutputStream bos = null; try { - ByteOutputStream bos = new ByteOutputStream(); + bos = new ByteOutputStream(); bos.write(is); content = bos.getBytes(); contentLength = bos.getCount(); } catch (IOException ioex) { throw new MessagingException("Error reading input stream", ioex); + } finally { + if (bos != null) + bos.close(); } } @@ -1075,8 +1079,12 @@ */ protected void updateHeaders() throws MessagingException { DataHandler dh = getDataHandler(); - if (dh == null) // Huh ? - return; + /* + * Code flow indicates null is never returned from + * getdataHandler() - findbugs + */ + //if (dh == null) // Huh ? + // return; try { String type = dh.getContentType(); --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java 2014-03-28 17:28:23.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java 2014-03-28 17:28:22.000000000 +0100 @@ -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 @@ -318,6 +318,7 @@ byte[] bndbytes = ASCIIUtility.getBytes(boundary); int bl = bndbytes.length; + ByteOutputStream buf = null; try { // Skip the preamble LineInputStream lin = new LineInputStream(in); @@ -370,7 +371,7 @@ if (!in.markSupported()) throw new MessagingException("Stream doesn't support mark"); - ByteOutputStream buf = null; + buf = null; // if we don't have a shared input stream, we copy the data if (sin == null) buf = new ByteOutputStream(); @@ -471,6 +472,9 @@ } } catch (IOException ioex) { throw new MessagingException("IO Error", ioex); + } finally { + if (buf != null) + buf.close(); } if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin== null) { --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimePullMultipart.java 2014-03-28 17:28:23.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimePullMultipart.java 2014-03-28 17:28:23.000000000 +0100 @@ -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 @@ -107,7 +107,7 @@ List prts = mm.getAttachments(); for(MIMEPart part : prts) { if (part != soapPart) { - AttachmentPart attach = new AttachmentPartImpl(part); + new AttachmentPartImpl(part); this.addBodyPart(new MimeBodyPart(part)); } } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/ASCIIUtility.java 2014-03-28 17:28:23.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/ASCIIUtility.java 2014-03-28 17:28:23.000000000 +0100 @@ -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 @@ -141,10 +141,13 @@ * Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}. */ public static byte[] getBytes(InputStream is) throws IOException { - ByteOutputStream bos = new ByteOutputStream(); + ByteOutputStream bos = null; try { + bos = new ByteOutputStream(); bos.write(is); } finally { + if (bos != null) + bos.close(); is.close(); } return bos.toByteArray(); --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java 2014-03-28 17:28:24.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java 2014-03-28 17:28:24.000000000 +0100 @@ -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 @@ -138,7 +138,6 @@ } public int getSize() throws SOAPException { - byte[] bytes; if (mimePart != null) { try { return mimePart.read().available(); @@ -388,6 +387,7 @@ } dataHandler = null; InputStream decoded = null; + ByteOutputStream bos = null; try { decoded = MimeUtility.decode(content, "base64"); InternetHeaders hdrs = new InternetHeaders(); @@ -395,7 +395,7 @@ //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on the InputStream // has markSupported()==true - ByteOutputStream bos = new ByteOutputStream(); + bos = new ByteOutputStream(); bos.write(decoded); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); @@ -403,8 +403,11 @@ log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { + if (bos != null) + bos.close(); try { - decoded.close(); + if (decoded != null) + decoded.close(); } catch (IOException ex) { throw new SOAPException(ex); } @@ -478,13 +481,14 @@ mimePart = null; } dataHandler = null; + ByteOutputStream bos = null; try { InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on whether the InputStream has // markSupported()==true or false - ByteOutputStream bos = new ByteOutputStream(); + bos = new ByteOutputStream(); bos.write(content); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); @@ -492,6 +496,8 @@ log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { + if (bos != null) + bos.close(); try { content.close(); } catch (IOException ex) { --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/Envelope.java 2014-03-28 17:28:24.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/Envelope.java 2014-03-28 17:28:24.000000000 +0100 @@ -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 @@ -29,6 +29,7 @@ import java.io.OutputStream; import javax.xml.soap.SOAPEnvelope; +import javax.xml.soap.SOAPException; import javax.xml.transform.Source; /** @@ -52,4 +53,8 @@ * Output the content. */ void output(OutputStream out, boolean isFastInfoset) throws IOException; + + void setStaxBridge(StaxBridge bridge) throws SOAPException; + + StaxBridge getStaxBridge() throws SOAPException; } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java 2014-03-28 17:28:25.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java 2014-03-28 17:28:25.000000000 +0100 @@ -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 @@ -29,18 +29,22 @@ import javax.xml.parsers.SAXParser; import javax.xml.soap.SOAPException; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.sax.SAXSource; +import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamSource; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; +import com.sun.xml.internal.messaging.saaj.LazyEnvelopeSource; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.util.*; - import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer; /** @@ -58,20 +62,73 @@ public static Envelope createEnvelope(Source src, SOAPPartImpl soapPart) throws SOAPException { + if (src instanceof JAXMStreamSource) { + try { + if (!SOAPPartImpl.lazyContentLength) { + ((JAXMStreamSource) src).reset(); + } + } catch (java.io.IOException ioe) { + log.severe("SAAJ0515.source.reset.exception"); + throw new SOAPExceptionImpl(ioe); + } + } + if (src instanceof LazyEnvelopeSource) { + return lazy((LazyEnvelopeSource)src, soapPart); + } + if (soapPart.message.isLazySoapBodyParsing()) { + return parseEnvelopeStax(src, soapPart); + } else { + return parseEnvelopeSax(src, soapPart); + } + } + + private static Envelope lazy(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException { + try { + StaxBridge staxBridge = new StaxLazySourceBridge(src, soapPart); + staxBridge.bridgeEnvelopeAndHeaders(); + Envelope env = (Envelope) soapPart.getEnvelope(); + env.setStaxBridge(staxBridge); + return env; + } catch (XMLStreamException e) { + throw new SOAPException(e); + } + } + + static private XMLInputFactory xmlInputFactory = null; + + private static Envelope parseEnvelopeStax(Source src, SOAPPartImpl soapPart) + throws SOAPException { + XMLStreamReader streamReader = null; + if (src instanceof StAXSource) { + streamReader = ((StAXSource) src).getXMLStreamReader(); + } + try { + if (streamReader == null) { + if (xmlInputFactory == null) xmlInputFactory = XMLInputFactory.newInstance(); + streamReader = xmlInputFactory.createXMLStreamReader(src); + } +// SaajStaxWriter saajWriter = new SaajStaxWriter(soapPart.message, soapPart.document); +// XMLStreamReaderToXMLStreamWriter readerWriterBridge = new XMLStreamReaderToXMLStreamWriter( +// streamReader, saajWriter, soapPart.getSOAPNamespace()); + + StaxBridge readerWriterBridge = new StaxReaderBridge(streamReader, soapPart); + //bridge will stop reading at body element, and parse upon request, so save it + //on the envelope + readerWriterBridge.bridgeEnvelopeAndHeaders(); + + Envelope env = (Envelope) soapPart.getEnvelope(); + env.setStaxBridge(readerWriterBridge); + return env; + } catch (Exception e) { + throw new SOAPException(e); + } + } + private static Envelope parseEnvelopeSax(Source src, SOAPPartImpl soapPart) + throws SOAPException { // Insert SAX filter to disallow Document Type Declarations since // they are not legal in SOAP SAXParser saxParser = null; if (src instanceof StreamSource) { - if (src instanceof JAXMStreamSource) { - try { - if (!SOAPPartImpl.lazyContentLength) { - ((JAXMStreamSource) src).reset(); - } - } catch (java.io.IOException ioe) { - log.severe("SAAJ0515.source.reset.exception"); - throw new SOAPExceptionImpl(ioe); - } - } try { saxParser = parserPool.get(); } catch (Exception e) { --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/MessageFactoryImpl.java 2014-03-28 17:28:25.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/MessageFactoryImpl.java 2014-03-28 17:28:25.000000000 +0100 @@ -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 @@ -29,6 +29,7 @@ import java.util.logging.Logger; import javax.xml.soap.*; +import javax.xml.stream.XMLStreamReader; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ParseException; @@ -66,12 +67,44 @@ throw new UnsupportedOperationException(); } + public SOAPMessage createMessage(String protocol) throws SOAPException { + if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) + return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl(); + else + return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.Message1_2Impl(); + } + public SOAPMessage createMessage(boolean isFastInfoset, boolean acceptFastInfoset) throws SOAPException { throw new UnsupportedOperationException(); } + public SOAPMessage createMessage(MimeHeaders headers, XMLStreamReader reader) throws SOAPException, IOException { + String contentTypeString = MessageImpl.getContentType(headers); + + if (listener != null) { + throw new SOAPException("Listener OutputStream is not supported with XMLStreamReader"); + } + + try { + ContentType contentType = new ContentType(contentTypeString); + int stat = MessageImpl.identifyContentType(contentType); + + if (MessageImpl.isSoap1_1Content(stat)) { + return new Message1_1Impl(headers,contentType,stat,reader); + } else if (MessageImpl.isSoap1_2Content(stat)) { + return new Message1_2Impl(headers,contentType,stat,reader); + } else { + log.severe("SAAJ0530.soap.unknown.Content-Type"); + throw new SOAPExceptionImpl("Unrecognized Content-Type"); + } + } catch (ParseException e) { + log.severe("SAAJ0531.soap.cannot.parse.Content-Type"); + throw new SOAPExceptionImpl( + "Unable to parse content type: " + e.getMessage()); + } + } public SOAPMessage createMessage(MimeHeaders headers, InputStream in) throws SOAPException, IOException { String contentTypeString = MessageImpl.getContentType(headers); --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java 2014-03-28 17:28:26.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java 2014-03-28 17:28:25.000000000 +0100 @@ -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 @@ -33,7 +33,9 @@ import javax.activation.DataHandler; import javax.activation.DataSource; import javax.xml.soap.*; +import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; +import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamSource; import com.sun.xml.internal.messaging.saaj.packaging.mime.Header; @@ -110,6 +112,8 @@ private InputStream inputStreamAfterSaveChanges = null; + public static final String LAZY_SOAP_BODY_PARSING = "saaj.lazy.soap.body"; + // switch back to old MimeMultipart incase of problem private static boolean switchOffBM = false; private static boolean switchOffLazyAttachment = false; @@ -341,7 +345,12 @@ } - private void init(MimeHeaders headers, int stat, final ContentType contentType, final InputStream in) throws SOAPExceptionImpl { + public MessageImpl(MimeHeaders headers, ContentType ct, int stat, + XMLStreamReader reader) throws SOAPExceptionImpl { + init(headers, stat, ct, reader); + } + + private void init(MimeHeaders headers, int stat, final ContentType contentType, final Object input) throws SOAPExceptionImpl { this.headers = headers; try { @@ -382,20 +391,42 @@ + " Expected: " + getExpectedContentType()); } - + InputStream in = null; + XMLStreamReader rdr = null; + if (input instanceof InputStream) { + in = (InputStream) input; + } else { + //is a StAX reader + rdr = (XMLStreamReader) input; + } if ((stat & PLAIN_XML_FLAG) != 0) { - if (isFastInfoset) { - getSOAPPart().setContent( - FastInfosetReflection.FastInfosetSource_new(in)); + if (in != null) { + if (isFastInfoset) { + getSOAPPart().setContent( + FastInfosetReflection.FastInfosetSource_new(in)); + } else { + initCharsetProperty(contentType); + getSOAPPart().setContent(new StreamSource(in)); + } } else { - initCharsetProperty(contentType); - getSOAPPart().setContent(new StreamSource(in)); + //is a StAX reader + if (isFastInfoset) { + //need to get FI stax reader + } else { + initCharsetProperty(contentType); + getSOAPPart().setContent(new StAXSource(rdr)); + } } } - else if ((stat & MIME_MULTIPART_FLAG) != 0) { + else if ((stat & MIME_MULTIPART_FLAG) != 0 && in == null) { + //only parse multipart in the inputstream case + //in stax reader case, we would be given the attachments separately + getSOAPPart().setContent(new StAXSource(rdr)); + } else if ((stat & MIME_MULTIPART_FLAG) != 0) { + final InputStream finalIn = in; DataSource ds = new DataSource() { public InputStream getInputStream() { - return in; + return finalIn; } public OutputStream getOutputStream() { @@ -487,7 +518,17 @@ } } - if (soapPartInputStream == null && soapMessagePart != null) { + // findbugs correctly points out that we'd NPE instantiating + // the ContentType (just below here) if soapMessagePart were + // null. Hence are better off throwing a controlled exception + // at this point if it is null. + if (soapMessagePart == null) { + log.severe("SAAJ0510.soap.cannot.create.envelope"); + throw new SOAPExceptionImpl( + "Unable to create envelope from given source: SOAP part not found"); + } + + if (soapPartInputStream == null) { soapPartInputStream = soapMessagePart.getInputStream(); } @@ -541,6 +582,15 @@ } } + public boolean isLazySoapBodyParsing() { + Object lazyParsingProp = getProperty(LAZY_SOAP_BODY_PARSING); + if (lazyParsingProp == null) return false; + if (lazyParsingProp instanceof Boolean) { + return ((Boolean) lazyParsingProp).booleanValue(); + } else { + return Boolean.valueOf(lazyParsingProp.toString()); + } + } public Object getProperty(String property) { return (String) properties.get(property); } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java 2014-03-28 17:28:26.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java 2014-03-28 17:28:26.000000000 +0100 @@ -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 @@ -107,11 +107,11 @@ } public org.w3c.dom.Text createTextNode(String data) { - return new TextImpl(this, data); + return new SOAPTextImpl(this, data); } public Comment createComment(String data) { - return new CommentImpl(this, data); + return new SOAPCommentImpl(this, data); } public CDATASection createCDATASection(String data) throws DOMException { --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java 2014-03-28 17:28:26.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java 2014-03-28 17:28:26.000000000 +0100 @@ -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 @@ -245,12 +245,18 @@ * getBytes() is called on a ByteInputStream. */ if (!(is instanceof ByteInputStream)) { - ByteOutputStream bout = new ByteOutputStream(); - bout.write(is); + ByteOutputStream bout = null; + try { + bout = new ByteOutputStream(); + bout.write(is); - // source.setInputStream(new ByteInputStream(...)) - FastInfosetReflection.FastInfosetSource_setInputStream( - source, bout.newInputStream()); + // source.setInputStream(new ByteInputStream(...)) + FastInfosetReflection.FastInfosetSource_setInputStream( + source, bout.newInputStream()); + } finally { + if (bout != null) + bout.close(); + } } this.source = source; } @@ -811,4 +817,6 @@ public String getSourceCharsetEncoding() { return sourceCharsetEncoding; } + + public abstract String getSOAPNamespace(); } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java 2014-03-28 17:28:27.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java 2014-03-28 17:28:27.000000000 +0100 @@ -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 @@ -31,14 +31,18 @@ import javax.xml.namespace.QName; import javax.xml.soap.*; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.*; +import org.w3c.dom.Node; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; +import com.sun.xml.internal.messaging.saaj.soap.StaxBridge; import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; /** @@ -48,6 +52,9 @@ */ public abstract class BodyImpl extends ElementImpl implements SOAPBody { private SOAPFault fault; +// private XMLStreamReaderToXMLStreamWriter staxBridge; + private StaxBridge staxBridge; + private boolean payloadStreamRead = false; protected BodyImpl(SOAPDocumentImpl ownerDoc, NameImpl bodyName) { super(ownerDoc, bodyName); @@ -136,13 +143,22 @@ } public boolean hasFault() { - initializeFault(); - return fault != null; + QName payloadQName = getPayloadQName(); + return getFaultQName().equals(payloadQName); + } + + private Object getFaultQName() { + return new QName(getNamespaceURI(), "Fault"); } public SOAPFault getFault() { - if (hasFault()) + if (hasFault()) { + if (fault == null) { + //initialize fault member + fault = (SOAPFault) getFirstChildElement(); + } return fault; + } return null; } @@ -322,4 +338,130 @@ return document; } + private void materializePayloadWrapException() { + try { + materializePayload(); + } catch (SOAPException e) { + throw new RuntimeException(e); + } + } + private void materializePayload() throws SOAPException { + if (staxBridge != null) { + if (payloadStreamRead) { + //the payload has already been read via stream reader and the + //stream has been exhausted already. Throw an + //exception since we are now trying to materialize as DOM and + //there is no stream left to read + throw new SOAPException("SOAPBody payload stream has been fully read - cannot materialize as DOM!"); + } + try { + staxBridge.bridgePayload(); + staxBridge = null; + payloadStreamRead = true; + } catch (XMLStreamException e) { + throw new SOAPException(e); + } + } + } + + @Override + public boolean hasChildNodes() { + boolean hasChildren = super.hasChildNodes(); + //to answer this question we need to know _whether_ we have at least one child + //So no need to materialize body if we already know we have a header child + if (!hasChildren) { + materializePayloadWrapException(); + } + return super.hasChildNodes(); + } + + @Override + public NodeList getChildNodes() { + materializePayloadWrapException(); + return super.getChildNodes(); + } + + @Override + public Node getFirstChild() { + Node child = super.getFirstChild(); + if (child == null) { + materializePayloadWrapException(); + } + return super.getFirstChild(); + } + + public Node getFirstChildNoMaterialize() { + return super.getFirstChild(); + } + + @Override + public Node getLastChild() { + materializePayloadWrapException(); + return super.getLastChild(); + } + + XMLStreamReader getPayloadReader() { + return staxBridge.getPayloadReader(); + } + + void setStaxBridge(StaxBridge bridge) { + this.staxBridge = bridge; + } + + StaxBridge getStaxBridge() { + return staxBridge; + } + + void setPayloadStreamRead() { + this.payloadStreamRead = true; + } + + QName getPayloadQName() { + if (staxBridge != null) { + return staxBridge.getPayloadQName(); + } else { + //not lazy - Just get first child element and return its name + Element elem = getFirstChildElement(); + if (elem != null) { + String ns = elem.getNamespaceURI(); + String pref = elem.getPrefix(); + String local = elem.getLocalName(); + if (pref != null) return new QName(ns, local, pref); + if (ns != null) return new QName(ns, local); + return new QName(local); + } + } + return null; + } + + String getPayloadAttributeValue(String attName) { + if (staxBridge != null) { + return staxBridge.getPayloadAttributeValue(attName); + } else { + //not lazy -Just get first child element and return its attribute + Element elem = getFirstChildElement(); + if (elem != null) { + return elem.getAttribute(localName); + } + } + return null; + } + + String getPayloadAttributeValue(QName attNAme) { + if (staxBridge != null) { + return staxBridge.getPayloadAttributeValue(attNAme); + } else { + //not lazy -Just get first child element and return its attribute + Element elem = getFirstChildElement(); + if (elem != null) { + return elem.getAttributeNS(attNAme.getNamespaceURI(), attNAme.getLocalPart()); + } + } + return null; + } + + public boolean isLazy() { + return (staxBridge != null && !payloadStreamRead); + } + } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java 2014-03-28 17:28:27.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java 2014-03-28 17:28:27.000000000 +0100 @@ -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 @@ -51,7 +51,7 @@ public static final String XENC_NS = "http://www.w3.org/2001/04/xmlenc#".intern(); public static final String WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".intern(); - private AttributeManager encodingStyleAttribute = new AttributeManager(); + private transient AttributeManager encodingStyleAttribute = new AttributeManager(); protected QName elementQName; @@ -424,7 +424,32 @@ } + Element getFirstChildElement() { + Node child = getFirstChild(); + while (child != null) { + if (child instanceof Element) { + return ((Element) child); + } + child = child.getNextSibling(); + } + return null; + } + protected SOAPElement findChild(NameImpl name) { + Node eachChild = getFirstChild(); + while (eachChild != null) { + if (eachChild instanceof SOAPElement) { + SOAPElement eachChildSoap = (SOAPElement) eachChild; + if (eachChildSoap.getElementName().equals(name)) { + return eachChildSoap; + } + } + eachChild = eachChild.getNextSibling(); + } + return null; + } + + protected SOAPElement findAndConvertChildElement(NameImpl name) { Iterator eachChild = getChildElementNodes(); while (eachChild.hasNext()) { SOAPElement child = (SOAPElement) eachChild.next(); --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/EnvelopeImpl.java 2014-03-28 17:28:28.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/EnvelopeImpl.java 2014-03-28 17:28:28.000000000 +0100 @@ -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 @@ -29,30 +29,36 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.util.Iterator; import java.util.logging.Level; -import org.w3c.dom.Document; import javax.xml.namespace.QName; import javax.xml.soap.*; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.sax.*; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; -import com.sun.xml.internal.messaging.saaj.soap.Envelope; +import com.sun.xml.internal.messaging.saaj.soap.LazyEnvelope; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; +import com.sun.xml.internal.messaging.saaj.soap.StaxBridge; +import com.sun.xml.internal.messaging.saaj.soap.StaxLazySourceBridge; import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; import com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection; +import com.sun.xml.internal.messaging.saaj.util.stax.LazyEnvelopeStaxReader; import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer; +import com.sun.xml.internal.org.jvnet.staxex.util.DOMStreamReader; +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; + /** * Our implementation of the SOAP envelope. * * @author Anil Vijendran (anil@sun.com) */ -public abstract class EnvelopeImpl extends ElementImpl implements Envelope { +public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope { protected HeaderImpl header; protected BodyImpl body; String omitXmlDecl = "yes"; @@ -103,11 +109,9 @@ NameImpl bodyName = getBodyName(prefix); HeaderImpl header = null; - SOAPElement firstChild = null; + SOAPElement firstChild = (SOAPElement) getFirstChildElement(); - Iterator eachChild = getChildElementNodes(); - if (eachChild.hasNext()) { - firstChild = (SOAPElement) eachChild.next(); + if (firstChild != null) { if (firstChild.getElementName().equals(headerName)) { log.severe("SAAJ0120.impl.header.already.exists"); throw new SOAPExceptionImpl("Can't add a header when one is already present."); @@ -254,6 +258,7 @@ public void output(OutputStream out) throws IOException { try { +// materializeBody(); Transformer transformer = EfficientStreamingTransformer.newTransformer(); @@ -357,4 +362,77 @@ + elementQName.getLocalPart() + " to " + newName.getLocalPart()); } + + @Override + public void setStaxBridge(StaxBridge bridge) throws SOAPException { + //set it on the body + ((BodyImpl) getBody()).setStaxBridge(bridge); + } + + @Override + public StaxBridge getStaxBridge() throws SOAPException { + return ((BodyImpl) getBody()).getStaxBridge(); + } + + @Override + public XMLStreamReader getPayloadReader() throws SOAPException { + return ((BodyImpl) getBody()).getPayloadReader(); + } + + @Override + public void writeTo(final XMLStreamWriter writer) throws XMLStreamException, SOAPException { + StaxBridge readBridge = this.getStaxBridge(); + if (readBridge != null && readBridge instanceof StaxLazySourceBridge) { +// StaxSoapWriteBridge writingBridge = new StaxSoapWriteBridge(this); +// writingBridge.write(writer); + final String soapEnvNS = this.getNamespaceURI(); + final DOMStreamReader reader = new DOMStreamReader(this); + XMLStreamReaderToXMLStreamWriter writingBridge = new XMLStreamReaderToXMLStreamWriter(); + writingBridge.bridge( new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, writer) { + public boolean proceedAfterStartElement() { + if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){ + return false; + } else + return true; + } + });//bridgeToBodyStartTag + ((StaxLazySourceBridge)readBridge).writePayloadTo(writer); + writer.writeEndElement();//body + writer.writeEndElement();//env + writer.writeEndDocument(); + writer.flush(); + } else { + LazyEnvelopeStaxReader lazyEnvReader = new LazyEnvelopeStaxReader(this); + XMLStreamReaderToXMLStreamWriter writingBridge = new XMLStreamReaderToXMLStreamWriter(); + writingBridge.bridge(lazyEnvReader, writer); +// writingBridge.bridge(new XMLStreamReaderToXMLStreamWriter.Breakpoint(lazyEnvReader, writer)); + } + //Assume the staxBridge is exhausted now since we would have read the body reader + ((BodyImpl) getBody()).setPayloadStreamRead(); + } + + @Override + public QName getPayloadQName() throws SOAPException { + return ((BodyImpl) getBody()).getPayloadQName(); + } + + @Override + public String getPayloadAttributeValue(String localName) throws SOAPException { + return ((BodyImpl) getBody()).getPayloadAttributeValue(localName); + } + + @Override + public String getPayloadAttributeValue(QName qName) throws SOAPException { + return ((BodyImpl) getBody()).getPayloadAttributeValue(qName); + } + + @Override + public boolean isLazy() { + try { + return ((BodyImpl) getBody()).isLazy(); + } catch (SOAPException e) { + return false; + } + } + } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/FaultImpl.java 2014-03-28 17:28:28.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/FaultImpl.java 2014-03-28 17:28:28.000000000 +0100 @@ -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 @@ -70,17 +70,17 @@ protected void findFaultCodeElement() { this.faultCodeElement = - (SOAPFaultElement) findChild(getFaultCodeName()); + (SOAPFaultElement) findAndConvertChildElement(getFaultCodeName()); } protected void findFaultActorElement() { this.faultActorElement = - (SOAPFaultElement) findChild(getFaultActorName()); + (SOAPFaultElement) findAndConvertChildElement(getFaultActorName()); } protected void findFaultStringElement() { this.faultStringElement = - (SOAPFaultElement) findChild(getFaultStringName()); + (SOAPFaultElement) findAndConvertChildElement(getFaultStringName()); } public void setFaultCode(String faultCode) throws SOAPException { @@ -162,7 +162,7 @@ protected void initializeDetail() { NameImpl detailName = getDetailName(); - detail = (Detail) findChild(detailName); + detail = (Detail) findAndConvertChildElement(detailName); } public Detail getDetail() { --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/HeaderImpl.java 2014-03-28 17:28:29.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/HeaderImpl.java 2014-03-28 17:28:28.000000000 +0100 @@ -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 @@ -32,6 +32,7 @@ import javax.xml.soap.*; import org.w3c.dom.Element; +import org.w3c.dom.Node; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument; --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Message1_1Impl.java 2014-03-28 17:28:29.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Message1_1Impl.java 2014-03-28 17:28:29.000000000 +0100 @@ -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,6 +35,7 @@ import java.util.logging.Logger; import javax.xml.soap.*; +import javax.xml.stream.XMLStreamReader; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType; @@ -70,6 +71,11 @@ super(headers,ct,stat,in); } + public Message1_1Impl(MimeHeaders headers, ContentType ct, int stat, XMLStreamReader reader) + throws SOAPExceptionImpl { + super(headers,ct,stat,reader); + } + public SOAPPart getSOAPPart() { if (soapPartImpl == null) { soapPartImpl = new SOAPPart1_1Impl(this); --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPPart1_1Impl.java 2014-03-28 17:28:29.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPPart1_1Impl.java 2014-03-28 17:28:29.000000000 +0100 @@ -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 @@ -90,4 +90,9 @@ return new SOAPPart1_1Impl(); } + @Override + public String getSOAPNamespace() { + return SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE; + } + } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java 2014-03-28 17:28:30.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java 2014-03-28 17:28:30.000000000 +0100 @@ -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 @@ -284,7 +284,7 @@ } public String getFaultNode() { - SOAPElement faultNode = findChild(getFaultNodeName()); + SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName()); if (faultNode == null) { return null; } @@ -292,7 +292,7 @@ } public void setFaultNode(String uri) throws SOAPException { - SOAPElement faultNode = findChild(getFaultNodeName()); + SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName()); if (faultNode != null) { faultNode.detachNode(); } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Message1_2Impl.java 2014-03-28 17:28:30.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Message1_2Impl.java 2014-03-28 17:28:30.000000000 +0100 @@ -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 @@ -33,6 +33,7 @@ import java.io.InputStream; import javax.xml.soap.*; +import javax.xml.stream.XMLStreamReader; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType; @@ -63,6 +64,11 @@ super(headers,ct,stat,in); } + public Message1_2Impl(MimeHeaders headers, ContentType ct, int stat, XMLStreamReader reader) + throws SOAPExceptionImpl { + super(headers,ct,stat,reader); + } + public SOAPPart getSOAPPart() { if (soapPartImpl == null) soapPartImpl = new SOAPPart1_2Impl(this); --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPPart1_2Impl.java 2014-03-28 17:28:31.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPPart1_2Impl.java 2014-03-28 17:28:31.000000000 +0100 @@ -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 @@ -87,4 +87,9 @@ return new SOAPPart1_2Impl(); } + @Override + public String getSOAPNamespace() { + return SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE; + } + } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/JAXMStreamSource.java 2014-03-28 17:28:31.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/JAXMStreamSource.java 2014-03-28 17:28:31.000000000 +0100 @@ -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 @@ -47,9 +47,15 @@ } else if (is instanceof ByteInputStream) { this.in = (ByteInputStream) is; } else { - ByteOutputStream bout = new ByteOutputStream(); - bout.write(is); - this.in = bout.newInputStream(); + ByteOutputStream bout = null; + try { + bout = new ByteOutputStream(); + bout.write(is); + this.in = bout.newInputStream(); + } finally { + if (bout != null) + bout.close(); + } } } --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/ParserPool.java 2014-03-28 17:28:31.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/ParserPool.java 2014-03-28 17:28:31.000000000 +0100 @@ -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 @@ -40,17 +40,15 @@ * Pool of SAXParser objects */ public class ParserPool { - private final BlockingQueue queue; + private final BlockingQueue queue; private SAXParserFactory factory; - private int capacity; public ParserPool(int capacity) { - this.capacity = capacity; - queue = new ArrayBlockingQueue(capacity); + queue = new ArrayBlockingQueue(capacity); //factory = SAXParserFactory.newInstance(); factory = new com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl(); factory.setNamespaceAware(true); - for (int i=0; i < capacity; i++) { + for (int i = 0; i < capacity; i++) { try { queue.put(factory.newSAXParser()); } catch (InterruptedException ex) { @@ -75,8 +73,8 @@ } - public void put(SAXParser parser) { - queue.offer(parser); + public boolean put(SAXParser parser) { + return queue.offer(parser); } public void returnParser(SAXParser saxParser) { --- old/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/CleanUpExecutorFactory.java 2014-03-28 17:28:32.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/CleanUpExecutorFactory.java 2014-03-28 17:28:32.000000000 +0100 @@ -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 @@ -25,7 +25,7 @@ package com.sun.xml.internal.org.jvnet.mimepull; -import java.util.concurrent.Executor; +import java.util.concurrent.ScheduledExecutorService; public abstract class CleanUpExecutorFactory { private static final String DEFAULT_PROPERTY_NAME = CleanUpExecutorFactory.class @@ -42,5 +42,5 @@ } } - public abstract Executor getExecutor(); + public abstract ScheduledExecutorService getScheduledExecutorService(); } --- old/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/WeakDataFile.java 2014-03-28 17:28:32.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/WeakDataFile.java 2014-03-28 17:28:32.000000000 +0100 @@ -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 @@ -25,6 +25,8 @@ package com.sun.xml.internal.org.jvnet.mimepull; +import java.util.concurrent.TimeUnit; + import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; @@ -32,7 +34,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.Executor; +import java.util.concurrent.ScheduledExecutorService; import java.util.logging.Level; import java.util.logging.Logger; @@ -45,6 +47,7 @@ final class WeakDataFile extends WeakReference { private static final Logger LOGGER = Logger.getLogger(WeakDataFile.class.getName()); + private static int TIMEOUT = 10; //milliseconds //private static final int MAX_ITERATIONS = 2; private static ReferenceQueue refQueue = new ReferenceQueue(); private static List refList = new ArrayList(); @@ -52,28 +55,22 @@ private final RandomAccessFile raf; private static boolean hasCleanUpExecutor = false; static { + int delay = 10; + try { + delay = Integer.getInteger("com.sun.xml.internal.org.jvnet.mimepull.delay", 10); + } catch (SecurityException se) { + if (LOGGER.isLoggable(Level.CONFIG)) { + LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.", + new Object[] {"com.sun.xml.internal.org.jvnet.mimepull.delay"}); + } + } CleanUpExecutorFactory executorFactory = CleanUpExecutorFactory.newInstance(); if (executorFactory!=null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Initializing clean up executor for MIMEPULL: {0}", executorFactory.getClass().getName()); } - Executor executor = executorFactory.getExecutor(); - executor.execute(new Runnable() { - @Override - public void run() { - WeakDataFile weak; - while (true) { - try { - weak = (WeakDataFile) refQueue.remove(); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "Cleaning file = {0} from reference queue.", weak.file); - } - weak.close(); - } catch (InterruptedException e) { - } - } - } - }); + ScheduledExecutorService scheduler = executorFactory.getScheduledExecutorService(); + scheduler.scheduleWithFixedDelay(new CleanupRunnable(), delay, delay, TimeUnit.SECONDS); hasCleanUpExecutor = true; } } @@ -157,4 +154,24 @@ weak.close(); } } + +private static class CleanupRunnable implements Runnable { + @Override + public void run() { + try { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Running cleanup task"); + } + WeakDataFile weak = (WeakDataFile) refQueue.remove(TIMEOUT); + while (weak != null) { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Cleaning file = {0} from reference queue.", weak.file); + } + weak.close(); + weak = (WeakDataFile) refQueue.remove(TIMEOUT); + } + } catch (InterruptedException e) { + } + } +} } --- old/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Data.java 2014-03-28 17:28:33.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Data.java 2014-03-28 17:28:32.000000000 +0100 @@ -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 @@ -62,6 +62,7 @@ private DataHandler dataHandler; private byte[] data; + private String hrefCid; /** * Length of the valid data in {@link #data}. @@ -531,4 +532,16 @@ // // } + public String getHrefCid() { + if (hrefCid == null && dataHandler != null && dataHandler instanceof StreamingDataHandler) { + hrefCid = ((StreamingDataHandler)dataHandler).getHrefCid(); + } + return hrefCid; + } + + public void setHrefCid(final String cid) { + this.hrefCid = cid; + if (dataHandler != null && dataHandler instanceof StreamingDataHandler) ((StreamingDataHandler)dataHandler).setHrefCid(cid); + } + } --- old/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StreamingDataHandler.java 2014-03-28 17:28:33.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StreamingDataHandler.java 2014-03-28 17:28:33.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -52,6 +52,8 @@ */ public abstract class StreamingDataHandler extends DataHandler implements Closeable { + private String hrefCid; + public StreamingDataHandler(Object o, String s) { super(o, s); } @@ -142,4 +144,11 @@ */ public abstract void close() throws IOException; + public String getHrefCid() { + return hrefCid; + } + + public void setHrefCid(final String cid) { + this.hrefCid = cid; + } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java 2014-03-28 17:28:33.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java 2014-03-28 17:28:33.000000000 +0100 @@ -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 @@ -30,7 +30,7 @@ import com.sun.xml.internal.ws.api.addressing.AddressingVersion; import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory; import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter; -import com.sun.xml.internal.ws.util.xml.XMLStreamReaderToXMLStreamWriter; +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; import com.sun.xml.internal.ws.server.WSEndpointImpl; import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants; import com.sun.istack.internal.Nullable; --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/api/addressing/WSEndpointReference.java 2014-03-28 17:28:34.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/api/addressing/WSEndpointReference.java 2014-03-28 17:28:34.000000000 +0100 @@ -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 @@ -52,7 +52,7 @@ import com.sun.xml.internal.ws.util.DOMUtil; import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter; import com.sun.xml.internal.ws.util.xml.XmlUtil; -import com.sun.xml.internal.ws.util.xml.XMLStreamReaderToXMLStreamWriter; +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants; import org.w3c.dom.Element; import org.xml.sax.*; --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/FilterMessageImpl.java 2014-03-28 17:28:34.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/FilterMessageImpl.java 2014-03-28 17:28:34.000000000 +0100 @@ -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 @@ -158,7 +158,7 @@ } public Message copy() { - return delegate.copy(); + return delegate.copy().copyFrom(delegate); } public @NotNull String getID(@NotNull WSBinding binding) { --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/Message.java 2014-03-28 17:28:35.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/Message.java 2014-03-28 17:28:35.000000000 +0100 @@ -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 @@ -196,6 +196,12 @@ */ public abstract class Message { + // See Packet for doc. + private boolean isProtocolMessage = false; + // next two are package protected - should only be used from Packet + boolean isProtocolMessage() { return isProtocolMessage; } + void setIsProtocolMessage() { isProtocolMessage = true; } + /** * Returns true if headers are present in the message. * @@ -724,12 +730,34 @@ *

* The restrictions placed on the use of copied {@link Message} can be * relaxed if necessary, but it will make the copy method more expensive. + * + *

IMPORTANT

+ *

WHEN YOU IMPLEMENT OR CHANGE A {@link .copy()} METHOD, YOU MUST + * USE THE {@link copyFrom(Message)} METHOD IN THE IMPLEMENTATION. */ // TODO: update the class javadoc with 'lifescope' // and move the discussion about life scope there. public abstract Message copy(); /** + * The {@link Message#copy()} method is used as a shorthand + * throughout the codecase in place of calling a copy constructor. + * However, that shorthand make it difficult to have a concrete + * method here in the base to do common work. + * + *

Rather than have each {@code copy} method duplicate code, the + * following method is used in each {@code copy} implementation. + * It MUST be called. + * + * @return The Message that calls {@code copyFrom} inside the + * {@code copy} method after the copy constructor + */ + public final Message copyFrom(Message m) { + isProtocolMessage = m.isProtocolMessage; + return this; + } + + /** * Retuns a unique id for the message. The id can be used for various things, * like debug assistance, logging, and MIME encoding(say for boundary). * --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/MessageWrapper.java 2014-03-28 17:28:35.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/MessageWrapper.java 2014-03-28 17:28:35.000000000 +0100 @@ -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 @@ -94,6 +94,11 @@ } @Override + boolean isProtocolMessage() { return delegate.isProtocolMessage(); } + @Override + void setIsProtocolMessage() { delegate.setIsProtocolMessage(); } + + @Override public boolean hasHeaders() { return delegate.hasHeaders(); } @@ -105,7 +110,7 @@ @Override public String toString() { - return delegate.toString(); + return "{MessageWrapper: " + delegate.toString() + "}"; } @Override @@ -214,7 +219,7 @@ @Override public Message copy() { - return delegate.copy(); + return delegate.copy().copyFrom(delegate); } @Override --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/Packet.java 2014-03-28 17:28:36.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/Packet.java 2014-03-28 17:28:36.000000000 +0100 @@ -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 @@ -248,6 +248,26 @@ if (message != null) this.message.setMessageMedadata(this); } + // ALL NEW PACKETS SHOULD HAVE THIS AS false. + // SETTING TO true MUST BE DONE EXPLICITLY, + // NOT VIA COPYING/RELATING PACKETS. + public boolean isProtocolMessage() { + return message != null && message.isProtocolMessage(); + } + public void setIsProtocolMessage() { + assert message != null; + message.setIsProtocolMessage(); + } + + private String userStateId; + public String getUserStateId() { + return userStateId; + } + public void setUserStateId(final String x) { + assert x != null && x.length() <= 256; + userStateId = x; + } + private WSDLOperationMapping wsdlOperationMapping = null; private QName wsdlOperation; @@ -894,6 +914,7 @@ response.component = request.component; response.mtomAcceptable = request.mtomAcceptable; response.mtomRequest = request.mtomRequest; + response.userStateId = request.userStateId; // copy other properties that need to be copied. is there any? } @@ -1255,6 +1276,12 @@ return getCodec().encode(this, buffer); } + /** + * This content type may be set by one of the following ways: + * (1) By the codec as a result of decoding an incoming message + * (2) Cached by a codec after encoding the message + * (3) By a caller of Codec.decode(InputStream, String contentType, Packet) + */ private ContentType contentType; /** @@ -1410,6 +1437,13 @@ //Use the getter to make sure all the logic is executed correctly MTOMFeature myMtomFeature = getMtomFeature(); if(myMtomFeature != null && myMtomFeature.isEnabled()) { + //If the content type is set already on this outbound Packet, + //(e.g.) through Codec.decode(InputStream, String contentType, Packet) + //and it is a non-mtom content type, then don't use mtom to encode it + ContentType curContentType = getInternalContentType(); + if (curContentType != null && !isMtomContentType(curContentType)) { + return false; + } //On client, always use XOP encoding if MTOM is enabled //On Server, mtomAcceptable and mtomRequest will be set - use XOP encoding //if either request is XOP encoded (mtomRequest) or @@ -1432,11 +1466,14 @@ } private boolean isMtomContentType() { - return (getInternalContentType() != null) && - (getInternalContentType().getContentType().contains("application/xop+xml")); + return (getInternalContentType() != null && isMtomContentType(getInternalContentType())); } - /** + private boolean isMtomContentType(ContentType cType) { + return cType.getContentType().contains("application/xop+xml"); + } + + /** * @deprecated */ public void addSatellite(@NotNull com.sun.xml.internal.ws.api.PropertySet satellite) { --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/StreamingSOAP.java 2014-03-28 17:28:36.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/StreamingSOAP.java 2014-03-28 17:28:36.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,17 @@ package com.sun.xml.internal.ws.api.message; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; public interface StreamingSOAP { public XMLStreamReader readEnvelope(); + public QName getPayloadQName(); + public XMLStreamReader readToBodyStarTag() throws XMLStreamException; + public XMLStreamReader readPayload() throws XMLStreamException; + public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException; + public void writePayloadTo(XMLStreamWriter writer)throws XMLStreamException; + public boolean isPayloadStreamReader(); } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SAAJFactory.java 2014-03-28 17:28:36.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SAAJFactory.java 2014-03-28 17:28:36.000000000 +0100 @@ -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 @@ -36,6 +36,7 @@ import javax.xml.stream.XMLStreamException; import org.xml.sax.SAXException; +import com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter; import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; import com.sun.xml.internal.ws.api.SOAPVersion; @@ -265,7 +266,7 @@ */ public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException { SOAPMessage msg = soapVersion.getMessageFactory().createMessage(); - SaajStaxWriter writer = new SaajStaxWriter(msg); + SaajStaxWriter writer = new SaajStaxWriter(msg, soapVersion.nsUri); try { message.writeTo(writer); } catch (XMLStreamException e) { --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java 2014-03-28 17:28:37.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java 2014-03-28 17:28:37.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -42,6 +42,8 @@ /** * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface. * + * @deprecated use com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter + * * @author shih-chang.chen@oracle.com */ public class SaajStaxWriter implements XMLStreamWriter { --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/SEIStub.java 2014-03-28 17:28:37.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/SEIStub.java 2014-03-28 17:28:37.000000000 +0100 @@ -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 @@ -28,7 +28,6 @@ import com.sun.istack.internal.NotNull; import com.sun.istack.internal.Nullable; import com.sun.xml.internal.ws.api.SOAPVersion; -import com.sun.xml.internal.ws.api.addressing.WSEndpointReference; import com.sun.xml.internal.ws.api.client.WSPortInfo; import com.sun.xml.internal.ws.api.databinding.Databinding; import com.sun.xml.internal.ws.api.addressing.WSEndpointReference; @@ -167,8 +166,7 @@ if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) { throw new IllegalStateException("Passed object is not proxy!"); } - Class declaringClass = method.getDeclaringClass(); - if (method == null || declaringClass == null + if (method == null || method.getDeclaringClass() == null || Modifier.isStatic(method.getModifiers())) { throw new IllegalStateException("Invoking static method is not allowed!"); } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/StreamingDataHandler.java 2014-03-28 17:28:38.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/StreamingDataHandler.java 2014-03-28 17:28:38.000000000 +0100 @@ -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 @@ -50,8 +50,6 @@ */ public abstract class StreamingDataHandler extends com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler { - private String hrefCid; - public StreamingDataHandler(Object o, String s) { super(o, s); } @@ -63,13 +61,4 @@ public StreamingDataHandler(DataSource dataSource) { super(dataSource); } - - public String getHrefCid() { - return hrefCid; - } - - public void setHrefCid(final String cid) { - this.hrefCid = cid; - } - } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/ContentTypeImpl.java 2014-03-28 17:28:38.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/ContentTypeImpl.java 2014-03-28 17:28:38.000000000 +0100 @@ -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 @@ -62,6 +62,7 @@ try { internalContentType = new ContentType(contentType); tmpCharset = internalContentType.getParameter("charset"); + rootId = internalContentType.getParameter("start"); } catch(Exception e) { //Ignore the parsing exception. } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MimeCodec.java 2014-03-28 17:28:39.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MimeCodec.java 2014-03-28 17:28:38.000000000 +0100 @@ -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 @@ -118,12 +118,14 @@ } ContentTypeImpl ctImpl = (ContentTypeImpl)getStaticContentType(packet); String boundary = ctImpl.getBoundary(); + String rootId = ctImpl.getRootId(); boolean hasAttachments = (boundary != null); Codec rootCodec = getMimeRootCodec(packet); if (hasAttachments) { writeln("--"+boundary, out); ContentType ct = rootCodec.getStaticContentType(packet); String ctStr = (ct != null) ? ct.getContentType() : rootCodec.getMimeType(); + if (rootId != null) writeln("Content-ID: " + rootId, out); writeln("Content-Type: " + ctStr, out); writeln(out); } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MtomCodec.java 2014-03-28 17:28:39.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MtomCodec.java 2014-03-28 17:28:39.000000000 +0100 @@ -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 @@ -112,9 +112,15 @@ } public static ContentType getStaticContentTypeStatic(Packet packet, SOAPVersion version) { - ContentType ct = (ContentType) packet.getInternalContentType(); - if ( ct != null ) return ct; - + ContentTypeImpl ct = (ContentTypeImpl) packet.getInternalContentType(); + if ( ct != null ) { + //Note - this case of boundary = null or root content ID = null should never happen + //after a recent bug fix in Packet.shouldUseMtom logic, but just in + //case we get here with a Packet that has a non-null content type with + //a null boundary, the content type of the Packet will be reset + if (ct.getBoundary() != null && ct.getRootId() != null) + return ct; + } String uuid = UUID.randomUUID().toString(); String boundary = "uuid:" + uuid; String rootId = ""; @@ -327,7 +333,7 @@ } public static class MtomStreamWriterImpl extends XMLStreamWriterFilter implements XMLStreamWriterEx, - MtomStreamWriter, HasEncoding { + com.sun.xml.internal.org.jvnet.staxex.util.MtomStreamWriter, HasEncoding { private final List mtomAttachments; private final String boundary; private final MTOMFeature myMtomFeature; --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/xml/XMLMessage.java 2014-03-28 17:28:39.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/xml/XMLMessage.java 2014-03-28 17:28:39.000000000 +0100 @@ -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 @@ -326,7 +326,7 @@ } public Message copy() { - return getMessage().copy(); + return getMessage().copy().copyFrom(getMessage()); } protected void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException { @@ -449,7 +449,7 @@ } public Message copy() { - return getMessage().copy(); + return getMessage().copy().copyFrom(getMessage()); } protected void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException { @@ -507,6 +507,7 @@ super(that.soapVersion); this.ds = that.ds; this.headerList = HeaderList.copy(that.headerList); + this.copyFrom(that); } public boolean hasUnconsumedDataSource() { @@ -560,7 +561,7 @@ } public Message copy() { - return new UnknownContent(this); + return new UnknownContent(this).copyFrom(this); } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java 2014-03-28 17:28:40.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java 2014-03-28 17:28:40.000000000 +0100 @@ -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 @@ -120,6 +120,7 @@ */ protected AbstractMessageImpl(AbstractMessageImpl that) { this.soapVersion = that.soapVersion; + this.copyFrom(that); } @Override @@ -150,11 +151,7 @@ hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null ); } - /** - * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)} - */ - @Override - public void writeTo(XMLStreamWriter w) throws XMLStreamException { + public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException { String soapNsUri = soapVersion.nsUri; w.writeStartDocument(); w.writeStartElement("S","Envelope",soapNsUri); @@ -169,7 +166,14 @@ } // write the body w.writeStartElement("S","Body",soapNsUri); + } + /** + * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)} + */ + @Override + public void writeTo(XMLStreamWriter w) throws XMLStreamException { + writeToBodyStart(w); writePayloadTo(w); w.writeEndElement(); --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/DOMMessage.java 2014-03-28 17:28:40.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/DOMMessage.java 2014-03-28 17:28:40.000000000 +0100 @@ -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 @@ -80,6 +80,7 @@ super(that); this.headers = HeaderList.copy(that.headers); this.payload = that.payload; + this.copyFrom(that); } public boolean hasHeaders() { @@ -150,7 +151,7 @@ } public Message copy() { - return new DOMMessage(this); + return new DOMMessage(this).copyFrom(this); } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/EmptyMessageImpl.java 2014-03-28 17:28:41.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/EmptyMessageImpl.java 2014-03-28 17:28:41.000000000 +0100 @@ -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 @@ -76,6 +76,7 @@ super(that); this.headers = new HeaderList(that.headers); this.attachmentSet = that.attachmentSet; + this.copyFrom(that); } public boolean hasHeaders() { @@ -115,7 +116,7 @@ } public Message copy() { - return new EmptyMessageImpl(this); + return new EmptyMessageImpl(this).copyFrom(this); } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/JAXBDispatchMessage.java 2014-03-28 17:28:41.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/JAXBDispatchMessage.java 2014-03-28 17:28:41.000000000 +0100 @@ -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 @@ -33,7 +33,7 @@ import com.sun.xml.internal.ws.message.PayloadElementSniffer; import com.sun.xml.internal.ws.spi.db.BindingContext; import com.sun.xml.internal.ws.spi.db.XMLBridge; -import com.sun.xml.internal.ws.streaming.MtomStreamWriter; +import com.sun.xml.internal.org.jvnet.staxex.util.MtomStreamWriter; import com.sun.xml.internal.ws.streaming.XMLStreamWriterUtil; import org.xml.sax.ContentHandler; import org.xml.sax.ErrorHandler; @@ -87,6 +87,7 @@ jaxbObject = that.jaxbObject; rawContext = that.rawContext; bridge = that.bridge; + copyFrom(that); } public JAXBDispatchMessage(JAXBContext rawContext, Object jaxbObject, SOAPVersion soapVersion) { @@ -178,7 +179,7 @@ @Override public Message copy() { - return new JAXBDispatchMessage(this); + return new JAXBDispatchMessage(this).copyFrom(this); } @Override --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/JAXBMessage.java 2014-03-28 17:28:41.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/JAXBMessage.java 2014-03-28 17:28:41.000000000 +0100 @@ -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 @@ -46,7 +46,7 @@ import com.sun.xml.internal.ws.spi.db.XMLBridge; import com.sun.xml.internal.ws.streaming.XMLStreamWriterUtil; import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; -import com.sun.xml.internal.ws.streaming.MtomStreamWriter; +import com.sun.xml.internal.org.jvnet.staxex.util.MtomStreamWriter; import com.sun.xml.internal.ws.util.xml.XMLReaderComposite; import com.sun.xml.internal.ws.util.xml.XMLReaderComposite.ElemInfo; @@ -240,6 +240,7 @@ this.jaxbObject = that.jaxbObject; this.bridge = that.bridge; this.rawContext = that.rawContext; + this.copyFrom(that); } @Override @@ -411,7 +412,7 @@ @Override public Message copy() { - return new JAXBMessage(this); + return new JAXBMessage(this).copyFrom(this); } public XMLStreamReader readEnvelope() { @@ -443,4 +444,35 @@ throw new RuntimeException(e); } } + + public boolean isPayloadStreamReader() { return false; } + + public QName getPayloadQName() { + return new QName(getPayloadNamespaceURI(), getPayloadLocalPart()); + } + + public XMLStreamReader readToBodyStarTag() { + int base = soapVersion.ordinal()*3; + this.envelopeTag = DEFAULT_TAGS.get(base); + this.bodyTag = DEFAULT_TAGS.get(base+2); + List hReaders = new java.util.ArrayList(); + ElemInfo envElem = new ElemInfo(envelopeTag, null); + ElemInfo bdyElem = new ElemInfo(bodyTag, envElem); + for (Header h : getHeaders().asList()) { + try { + hReaders.add(h.readHeader()); + } catch (XMLStreamException e) { + throw new RuntimeException(e); + } + } + XMLStreamReader soapHeader = null; + if(hReaders.size()>0) { + headerTag = DEFAULT_TAGS.get(base+1); + ElemInfo hdrElem = new ElemInfo(headerTag, envElem); + soapHeader = new XMLReaderComposite(hdrElem, hReaders.toArray(new XMLStreamReader[hReaders.size()])); + } + XMLStreamReader soapBody = new XMLReaderComposite(bdyElem, new XMLStreamReader[]{}); + XMLStreamReader[] soapContent = (soapHeader != null) ? new XMLStreamReader[]{soapHeader, soapBody} : new XMLStreamReader[]{soapBody}; + return new XMLReaderComposite(envElem, soapContent); + } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/saaj/SAAJMessage.java 2014-03-28 17:28:42.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/saaj/SAAJMessage.java 2014-03-28 17:28:42.000000000 +0100 @@ -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 @@ -492,9 +492,11 @@ * the {@link com.sun.xml.internal.ws.api.message.Message} implementation itself. */ public Message copy() { + Message result = null; try { + access(); if (!parsedMessage) { - return new SAAJMessage(readAsSOAPMessage()); + result = new SAAJMessage(readAsSOAPMessage()); } else { SOAPMessage msg = soapVersion.getMessageFactory().createMessage(); SOAPBody newBody = msg.getSOAPPart().getEnvelope().getBody(); @@ -503,8 +505,9 @@ newBody.appendChild(n); } addAttributes(newBody, bodyAttrs); - return new SAAJMessage(getHeaders(), getAttachments(), msg, soapVersion); + result = new SAAJMessage(getHeaders(), getAttachments(), msg, soapVersion); } + return result.copyFrom(this); } catch (SOAPException e) { throw new WebServiceException(e); } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/source/ProtocolSourceMessage.java 2014-03-28 17:28:42.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/source/ProtocolSourceMessage.java 2014-03-28 17:28:42.000000000 +0100 @@ -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 @@ -98,7 +98,7 @@ } public Message copy() { - return sm.copy(); + return sm.copy().copyFrom(sm); } public Source readEnvelopeAsSource() { --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/stream/PayloadStreamReaderMessage.java 2014-03-28 17:28:43.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/stream/PayloadStreamReaderMessage.java 2014-03-28 17:28:43.000000000 +0100 @@ -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 @@ -107,7 +107,7 @@ } public Message copy() { - return message.copy(); + return message.copy().copyFrom(message); } @Override --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/stream/StreamMessage.java 2014-03-28 17:28:43.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/stream/StreamMessage.java 2014-03-28 17:28:43.000000000 +0100 @@ -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 @@ -50,7 +50,7 @@ import com.sun.xml.internal.ws.util.xml.DummyLocation; import com.sun.xml.internal.ws.util.xml.StAXSource; import com.sun.xml.internal.ws.util.xml.XMLReaderComposite; -import com.sun.xml.internal.ws.util.xml.XMLStreamReaderToXMLStreamWriter; +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; import com.sun.xml.internal.ws.util.xml.XMLReaderComposite.ElemInfo; import org.xml.sax.ContentHandler; @@ -61,6 +61,7 @@ import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; import javax.xml.stream.*; import static javax.xml.stream.XMLStreamConstants.START_DOCUMENT; @@ -415,11 +416,7 @@ writeEnvelope(sw); } - /** - * This method should be called when the StreamMessage is created with a payload - * @param writer - */ - private void writeEnvelope(XMLStreamWriter writer) throws XMLStreamException { + public void writeToBodyStart(XMLStreamWriter writer) throws XMLStreamException { if ( envelopeReader != null ) readEnvelope(this); writer.writeStartDocument(); envelopeTag.writeStart(writer); @@ -437,6 +434,15 @@ writer.writeEndElement(); } bodyTag.writeStart(writer); + + } + + /** + * This method should be called when the StreamMessage is created with a payload + * @param writer + */ + private void writeEnvelope(XMLStreamWriter writer) throws XMLStreamException { + writeToBodyStart(writer); if(hasPayload()) writePayloadTo(writer); writer.writeEndElement(); @@ -550,7 +556,7 @@ proceedToRootElement(reader); proceedToRootElement(clone); - return new StreamMessage(envelopeTag, headerTag, attachmentSet, HeaderList.copy(headers), bodyPrologue, bodyTag, bodyEpilogue, clone, soapVersion); + return new StreamMessage(envelopeTag, headerTag, attachmentSet, HeaderList.copy(headers), bodyPrologue, bodyTag, bodyEpilogue, clone, soapVersion).copyFrom(this); } catch (XMLStreamException e) { throw new WebServiceException("Failed to copy a message",e); } @@ -763,4 +769,30 @@ // the pipe line. return new MutableXMLStreamBuffer(); } + + public boolean isPayloadStreamReader() { return true; } + + public QName getPayloadQName() { + return this.hasPayload() ? new QName(payloadNamespaceURI, payloadLocalName) : null; + } + + public XMLStreamReader readToBodyStarTag() { + if ( envelopeReader != null ) readEnvelope(this); + List hReaders = new java.util.ArrayList(); + ElemInfo envElem = new ElemInfo(envelopeTag, null); + ElemInfo hdrElem = (headerTag != null) ? new ElemInfo(headerTag, envElem) : null; + ElemInfo bdyElem = new ElemInfo(bodyTag, envElem); + for (Header h : getHeaders().asList()) { + try { + hReaders.add(h.readHeader()); + } catch (XMLStreamException e) { + throw new RuntimeException(e); + } + } + XMLStreamReader soapHeader = (hdrElem != null) ? new XMLReaderComposite(hdrElem, hReaders.toArray(new XMLStreamReader[hReaders.size()])) : null; + XMLStreamReader[] payload = {}; + XMLStreamReader soapBody = new XMLReaderComposite(bdyElem, payload); + XMLStreamReader[] soapContent = (soapHeader != null) ? new XMLStreamReader[]{soapHeader, soapBody} : new XMLStreamReader[]{soapBody}; + return new XMLReaderComposite(envElem, soapContent); + } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/PolicyMapUtil.java 2014-03-28 17:28:44.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/PolicyMapUtil.java 2014-03-28 17:28:44.000000000 +0100 @@ -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 @@ -34,6 +34,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; +import java.util.Map.Entry; import javax.xml.namespace.QName; /** @@ -102,17 +103,17 @@ } final PolicyMapKeyConverter converter = new PolicyMapKeyConverter(serviceName, portName); - for (WsdlBindingSubject wsdlSubject : subjectToPolicies.keySet()) { - final PolicySubject newSubject = new PolicySubject(wsdlSubject, subjectToPolicies.get(wsdlSubject)); + for (Entry> entry : subjectToPolicies.entrySet()) { + WsdlBindingSubject wsdlSubject = entry.getKey(); + Collection policySet = entry.getValue(); + final PolicySubject newSubject = new PolicySubject(wsdlSubject, policySet); PolicyMapKey mapKey = converter.getPolicyMapKey(wsdlSubject); if (wsdlSubject.isBindingSubject()) { policyMap.putSubject(ScopeType.ENDPOINT, mapKey, newSubject); - } - else if (wsdlSubject.isBindingOperationSubject()) { + } else if (wsdlSubject.isBindingOperationSubject()) { policyMap.putSubject(ScopeType.OPERATION, mapKey, newSubject); - } - else if (wsdlSubject.isBindingMessageSubject()) { + } else if (wsdlSubject.isBindingMessageSubject()) { switch (wsdlSubject.getMessageType()) { case INPUT: policyMap.putSubject(ScopeType.INPUT_MESSAGE, mapKey, newSubject); @@ -123,6 +124,8 @@ case FAULT: policyMap.putSubject(ScopeType.FAULT_MESSAGE, mapKey, newSubject); break; + default: + break; } } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/Localization.properties 2014-03-28 17:28:44.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/Localization.properties 2014-03-28 17:28:44.000000000 +0100 @@ -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 @@ -118,3 +118,4 @@ WSP_0093_INVALID_URI=WSP0093: Invalid URI "{0}" at location {1} WSP_0094_INVALID_URN=WSP0094: Internal implementation error. Apparently failed to pass valid URN. WSP_0095_INVALID_BOOLEAN_VALUE=WSP0095: A value of boolean type may have one of the values "true", "false", "1", "0". This value was "{0}". +WSP_0096_ERROR_WHILE_COMBINE=WSP0096: Error while combining {0}. --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/LocalizationMessages.java 2014-03-28 17:28:44.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/LocalizationMessages.java 2014-03-28 17:28:44.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -76,6 +76,18 @@ return localizer.localize(localizableWSP_0081_UNABLE_TO_INSERT_CHILD(arg0, arg1)); } + public static Localizable localizableWSP_0096_ERROR_WHILE_COMBINE(Object arg0) { + return messageFactory.getMessage("WSP_0096_ERROR_WHILE_COMBINE", arg0); + } + + /** + * WSP0096: Error while combining {0}. + * + */ + public static String WSP_0096_ERROR_WHILE_COMBINE(Object arg0) { + return localizer.localize(localizableWSP_0096_ERROR_WHILE_COMBINE(arg0)); + } + public static Localizable localizableWSP_0018_UNABLE_TO_ACCESS_POLICY_SOURCE_MODEL(Object arg0) { return messageFactory.getMessage("WSP_0018_UNABLE_TO_ACCESS_POLICY_SOURCE_MODEL", arg0); } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/PolicyUtils.java 2014-03-28 17:28:45.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/PolicyUtils.java 2014-03-28 17:28:45.000000000 +0100 @@ -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 @@ -39,6 +39,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import java.util.logging.Level; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; @@ -200,6 +201,7 @@ } public static class Collections { + private static final PolicyLogger LOGGER = PolicyLogger.getLogger(PolicyUtils.Collections.class); /** * TODO javadocs * @@ -245,7 +247,10 @@ } else if (optionSize == 1) { base.addAll(option); } else { - optionProcessingQueue.offer(option); + boolean entered = optionProcessingQueue.offer(option); + if (!entered) { + throw LOGGER.logException(new RuntimePolicyUtilsException(LocalizationMessages.WSP_0096_ERROR_WHILE_COMBINE(option)), false, Level.WARNING); + } finalCombinationsSize *= optionSize; } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/server/EndpointFactory.java 2014-03-28 17:28:45.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/server/EndpointFactory.java 2014-03-28 17:28:45.000000000 +0100 @@ -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 @@ -89,11 +89,16 @@ import java.io.IOException; import java.net.URL; +import java.util.AbstractCollection; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; /** @@ -189,13 +194,24 @@ invoker = InstanceResolver.createDefault(implType).createInvoker(); } - List md = new ArrayList(); - if(metadata!=null) + // Performance analysis indicates that reading and parsing imported schemas is + // a major component of Endpoint creation time. Therefore, modify SDDocumentSource + // handling to delay iterating collection as long as possible. + Collection md = new CollectionCollection(); + if(primaryWsdl!=null) { + if(metadata!=null) { + Iterator it = metadata.iterator(); + if (it.hasNext() && primaryWsdl.equals(it.next())) + md.addAll(metadata); + else { + md.add(primaryWsdl); + md.addAll(metadata); + } + } else + md.add(primaryWsdl); + } else if(metadata!=null) md.addAll(metadata); - if(primaryWsdl!=null && !md.contains(primaryWsdl)) - md.add(primaryWsdl); - if(container==null) container = ContainerResolver.getInstance().getContainer(); @@ -227,7 +243,7 @@ } // Categorises the documents as WSDL, Schema etc - List docList = categoriseMetadata(md, serviceName, portTypeName); + Collection docList = categoriseMetadata(md.iterator(), serviceName, portTypeName); // Finds the primary WSDL and makes sure that metadata doesn't have // two concrete or abstract WSDLs SDDocumentImpl primaryDoc = primaryWsdl != null ? SDDocumentImpl.create(primaryWsdl,serviceName,portTypeName) : findPrimary(docList); @@ -326,50 +342,87 @@ * * @param primaryDoc primary WSDL doc * @param docList complete metadata - * @return new metadata that doesn't contain extraneous documnets. + * @return new metadata that doesn't contain extraneous documents. */ - private static List findMetadataClosure(SDDocumentImpl primaryDoc, List docList, EntityResolver resolver) { - // create a map for old metadata - Map oldMap = new HashMap(); - for(SDDocumentImpl doc : docList) { - oldMap.put(doc.getSystemId().toString(), doc); - } - // create a map for new metadata - Map newMap = new HashMap(); - newMap.put(primaryDoc.getSystemId().toString(), primaryDoc); - - List remaining = new ArrayList(); - remaining.addAll(primaryDoc.getImports()); - while(!remaining.isEmpty()) { - String url = remaining.remove(0); - SDDocumentImpl doc = oldMap.get(url); - if (doc == null) { - // old metadata doesn't have this imported doc, may be external - if (resolver != null) { - try { - InputSource source = resolver.resolveEntity(null, url); - if (source != null) { - MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer(); - XMLStreamReader reader = XmlUtil.newXMLInputFactory(true).createXMLStreamReader(source.getByteStream()); - xsb.createFromXMLStreamReader(reader); + private static Collection findMetadataClosure( + final SDDocumentImpl primaryDoc, final Collection docList, final EntityResolver resolver) { + return new AbstractCollection() { + @Override + public Iterator iterator() { + // create a map for old metadata + Map oldMap = new HashMap(); + Iterator oldDocs = docList.iterator(); + + // create a map for new metadata + Map newMap = new HashMap(); + newMap.put(primaryDoc.getSystemId().toString(), primaryDoc); + + List remaining = new ArrayList(); + remaining.addAll(primaryDoc.getImports()); + while(!remaining.isEmpty()) { + String url = remaining.remove(0); + SDDocumentImpl doc = oldMap.get(url); + if (doc == null) { + while (oldDocs.hasNext()) { + SDDocumentImpl old = oldDocs.next(); + String id = old.getSystemId().toString(); + oldMap.put(id, old); + if (id.equals(url)) { + doc = old; + break; + } + } - SDDocumentSource sdocSource = SDDocumentImpl.create(new URL(url), xsb); - doc = SDDocumentImpl.create(sdocSource, null, null); + if (doc == null) { + // old metadata doesn't have this imported doc, may be external + if (resolver != null) { + try { + InputSource source = resolver.resolveEntity(null, url); + if (source != null) { + MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer(); + XMLStreamReader reader = XmlUtil.newXMLInputFactory(true).createXMLStreamReader(source.getByteStream()); + xsb.createFromXMLStreamReader(reader); + + SDDocumentSource sdocSource = SDDocumentImpl.create(new URL(url), xsb); + doc = SDDocumentImpl.create(sdocSource, null, null); + } + } catch (Exception ex) { + ex.printStackTrace(); + } } - } catch (Exception ex) { - ex.printStackTrace(); } + } + // Check if new metadata already contains this doc + if (doc != null && !newMap.containsKey(url)) { + newMap.put(url, doc); + remaining.addAll(doc.getImports()); + } } + + return newMap.values().iterator(); + } + + @Override + public int size() { + int size = 0; + Iterator it = iterator(); + while (it.hasNext()) { + it.next(); + size++; + } + return size; } - // Check if new metadata already contains this doc - if (doc != null && !newMap.containsKey(url)) { - newMap.put(url, doc); - remaining.addAll(doc.getImports()); + + @Override + public void clear() { + throw new UnsupportedOperationException(); } - } - List newMetadata = new ArrayList(); - newMetadata.addAll(newMap.values()); - return newMetadata; + + @Override + public boolean isEmpty() { + return docList.isEmpty(); + } + }; } private static void processHandlerAnnotation(WSBinding binding, Class implType, QName serviceName, QName portName) { @@ -599,7 +652,7 @@ * Generates the WSDL and XML Schema for the endpoint if necessary * It generates WSDL only for SOAP1.1, and for XSOAP1.2 bindings */ - private static SDDocumentImpl generateWSDL(WSBinding binding, AbstractSEIModelImpl seiModel, List docs, + private static SDDocumentImpl generateWSDL(WSBinding binding, AbstractSEIModelImpl seiModel, Collection docs, Container container, Class implType) { BindingID bindingId = binding.getBindingId(); if (!bindingId.canGenerateWSDL()) { @@ -634,14 +687,59 @@ /** * Builds {@link SDDocumentImpl} from {@link SDDocumentSource}. */ - private static List categoriseMetadata( - List src, QName serviceName, QName portTypeName) { + private static Collection categoriseMetadata( + final Iterator src, final QName serviceName, final QName portTypeName) { - List r = new ArrayList(src.size()); - for (SDDocumentSource doc : src) { - r.add(SDDocumentImpl.create(doc,serviceName,portTypeName)); - } - return r; + return new AbstractCollection() { + private final Collection theConverted = new ArrayList(); + + @Override + public boolean add(SDDocumentImpl arg0) { + return theConverted.add(arg0); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private Iterator convIt = theConverted.iterator(); + @Override + public boolean hasNext() { + if (convIt != null && convIt.hasNext()) + return true; + return src.hasNext(); + } + + @Override + public SDDocumentImpl next() { + if (convIt != null && convIt.hasNext()) + return convIt.next(); + convIt = null; + if (!src.hasNext()) + throw new NoSuchElementException(); + SDDocumentImpl next = SDDocumentImpl.create(src.next(),serviceName,portTypeName); + theConverted.add(next); + return next; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } + + @Override + public int size() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isEmpty() { + if (!theConverted.isEmpty()) + return false; + return !src.hasNext(); + } + }; } /** @@ -675,7 +773,7 @@ * @return primay wsdl document, null if is not there in the docList * */ - private static @Nullable SDDocumentImpl findPrimary(@NotNull List docList) { + private static @Nullable SDDocumentImpl findPrimary(@NotNull Collection docList) { SDDocumentImpl primaryDoc = null; boolean foundConcrete = false; boolean foundAbstract = false; @@ -710,7 +808,7 @@ * @param container container in which this service is running * @return non-null wsdl port object */ - private static @NotNull WSDLPort getWSDLPort(SDDocumentSource primaryWsdl, List metadata, + private static @NotNull WSDLPort getWSDLPort(SDDocumentSource primaryWsdl, Collection metadata, @NotNull QName serviceName, @NotNull QName portName, Container container, EntityResolver resolver) { URL wsdlUrl = primaryWsdl.getSystemId(); @@ -746,13 +844,12 @@ * {@link XMLEntityResolver} that can resolve to {@link SDDocumentSource}s. */ private static final class EntityResolverImpl implements XMLEntityResolver { - private Map metadata = new HashMap(); + private Iterator origMetadata; + private Map metadata = new ConcurrentHashMap(); private EntityResolver resolver; - public EntityResolverImpl(List metadata, EntityResolver resolver) { - for (SDDocumentSource doc : metadata) { - this.metadata.put(doc.getSystemId().toExternalForm(),doc); - } + public EntityResolverImpl(Collection metadata, EntityResolver resolver) { + this.origMetadata = metadata.iterator(); this.resolver = resolver; } @@ -761,6 +858,15 @@ SDDocumentSource doc = metadata.get(systemId); if (doc != null) return new Parser(doc); + synchronized(this) { + while(origMetadata.hasNext()) { + doc = origMetadata.next(); + String extForm = doc.getSystemId().toExternalForm(); + this.metadata.put(extForm,doc); + if (systemId.equals(extForm)) + return new Parser(doc); + } + } } if (resolver != null) { try { @@ -780,4 +886,72 @@ private static final Logger logger = Logger.getLogger( com.sun.xml.internal.ws.util.Constants.LoggingDomain + ".server.endpoint"); + + private static class CollectionCollection extends AbstractCollection { + + private final Collection> cols = new ArrayList>(); + + @Override + public Iterator iterator() { + final Iterator> colIt = cols.iterator(); + return new Iterator() { + private Iterator current = null; + + @Override + public boolean hasNext() { + if (current == null || !current.hasNext()) { + do { + if (!colIt.hasNext()) + return false; + current = colIt.next().iterator(); + } while (!current.hasNext()); + return true; + } + return true; + } + + @Override + public T next() { + if (!hasNext()) + throw new NoSuchElementException(); + return current.next(); + } + + @Override + public void remove() { + if (current == null) + throw new IllegalStateException(); + current.remove(); + } + }; + } + + @Override + public int size() { + int size = 0; + for (Collection c : cols) + size += c.size(); + return size; + } + + @Override + public boolean add(T arg0) { + return cols.add(Collections.singleton(arg0)); + } + + @Override + public boolean addAll(Collection arg0) { + return cols.add(arg0); + } + + @Override + public void clear() { + cols.clear(); + } + + @Override + public boolean isEmpty() { + return !iterator().hasNext(); + } + } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/server/SDDocumentImpl.java 2014-03-28 17:28:46.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/server/SDDocumentImpl.java 2014-03-28 17:28:46.000000000 +0100 @@ -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 @@ -31,7 +31,7 @@ import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; import com.sun.xml.internal.ws.wsdl.SDDocumentResolver; import com.sun.xml.internal.ws.util.RuntimeVersion; -import com.sun.xml.internal.ws.util.xml.XMLStreamReaderToXMLStreamWriter; +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; import com.sun.xml.internal.ws.wsdl.parser.ParserUtil; import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants; import com.sun.xml.internal.ws.wsdl.writer.DocumentLocationResolver; --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/server/ServiceDefinitionImpl.java 2014-03-28 17:28:47.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/server/ServiceDefinitionImpl.java 2014-03-28 17:28:47.000000000 +0100 @@ -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 @@ -32,6 +32,7 @@ import com.sun.xml.internal.ws.wsdl.SDDocumentResolver; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -47,7 +48,7 @@ * @author Kohsuke Kawaguchi */ public final class ServiceDefinitionImpl implements ServiceDefinition, SDDocumentResolver { - private final List docs; + private final Collection docs; private final Map bySystemId; private final @NotNull SDDocumentImpl primaryWsdl; @@ -65,12 +66,20 @@ * There must be at least one entry. * The first document is considered {@link #getPrimary() primary}. */ - public ServiceDefinitionImpl(List docs, @NotNull SDDocumentImpl primaryWsdl) { + public ServiceDefinitionImpl(Collection docs, @NotNull SDDocumentImpl primaryWsdl) { assert docs.contains(primaryWsdl); this.docs = docs; this.primaryWsdl = primaryWsdl; + this.bySystemId = new HashMap(); + } + + private boolean isInitialized = false; + + private synchronized void init() { + if (isInitialized) + return; + isInitialized = true; - this.bySystemId = new HashMap(docs.size()); for (SDDocumentImpl doc : docs) { bySystemId.put(doc.getURL().toExternalForm(),doc); doc.setFilters(filters); @@ -95,6 +104,7 @@ } public Iterator iterator() { + init(); return (Iterator)docs.iterator(); } @@ -106,6 +116,7 @@ * null if none is found. */ public SDDocument resolve(String systemId) { + init(); return bySystemId.get(systemId); } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/server/WSDLGenResolver.java 2014-03-28 17:28:47.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/server/WSDLGenResolver.java 2014-03-28 17:28:47.000000000 +0100 @@ -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,9 +35,11 @@ import javax.xml.transform.Result; import javax.xml.ws.Holder; import javax.xml.ws.WebServiceException; + import java.net.URL; import java.net.MalformedURLException; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -50,7 +52,7 @@ */ final class WSDLGenResolver implements com.oracle.webservices.internal.api.databinding.WSDLResolver { - private final List docs; + private final Collection docs; private final List newDocs = new ArrayList(); private SDDocumentSource concreteWsdlSource; @@ -65,7 +67,7 @@ private final QName serviceName; private final QName portTypeName; - public WSDLGenResolver(@NotNull List docs,QName serviceName,QName portTypeName) { + public WSDLGenResolver(@NotNull Collection docs,QName serviceName,QName portTypeName) { this.docs = docs; this.serviceName = serviceName; this.portTypeName = portTypeName; --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/FieldGetter.java 2014-03-28 17:28:48.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/FieldGetter.java 2014-03-28 17:28:48.000000000 +0100 @@ -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 @@ -26,9 +26,7 @@ package com.sun.xml.internal.ws.spi.db; import java.lang.reflect.Field; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; +import javax.xml.ws.WebServiceException; /** @@ -42,6 +40,7 @@ protected Field field; public FieldGetter(Field f) { + verifyWrapperType(f.getDeclaringClass()); field = f; type = f.getType(); } @@ -50,43 +49,12 @@ return field; } - static class PrivilegedGetter implements PrivilegedExceptionAction { - private Object value; - private Field field; - private Object instance; - public PrivilegedGetter(Field field, Object instance) { - super(); - this.field = field; - this.instance = instance; - } - public Object run() throws IllegalAccessException { - if (!field.isAccessible()) { - field.setAccessible(true); - } - value = field.get(instance); - return null; - } - } - public Object get(final Object instance) { - if (field.isAccessible()) { - try { - return field.get(instance); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } else { - PrivilegedGetter privilegedGetter = new PrivilegedGetter(field, instance); - try { - AccessController.doPrivileged(privilegedGetter); - } catch (PrivilegedActionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return privilegedGetter.value; + try { + return field.get(instance); + } catch (Exception e) { + throw new WebServiceException(e); } - return null; } public A getAnnotation(Class annotationType) { --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/FieldSetter.java 2014-03-28 17:28:48.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/FieldSetter.java 2014-03-28 17:28:48.000000000 +0100 @@ -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 @@ -26,10 +26,8 @@ package com.sun.xml.internal.ws.spi.db; import java.lang.reflect.Field; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - +import javax.xml.ws.WebServiceException; +import static com.sun.xml.internal.ws.spi.db.PropertyGetterBase.verifyWrapperType; /** * FieldSetter @@ -41,6 +39,7 @@ protected Field field; public FieldSetter(Field f) { + verifyWrapperType(f.getDeclaringClass()); field = f; type = f.getType(); } @@ -49,29 +48,12 @@ return field; } - public void set(final Object instance, final Object resource) { - if (field.isAccessible()) { - try { - field.set(instance, resource); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } else { - try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws IllegalAccessException { - if (!field.isAccessible()) { - field.setAccessible(true); - } - field.set(instance, resource); - return null; - } - }); - } catch (PrivilegedActionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void set(final Object instance, final Object val) { + final Object resource = (type.isPrimitive() && val == null)? uninitializedValue(type): val; + try { + field.set(instance, resource); + } catch (Exception e) { + throw new WebServiceException(e); } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/JAXBWrapperAccessor.java 2014-03-28 17:28:49.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/JAXBWrapperAccessor.java 2014-03-28 17:28:49.000000000 +0100 @@ -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 @@ -45,6 +45,8 @@ import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.namespace.QName; +import javax.xml.ws.WebServiceException; +import static com.sun.xml.internal.ws.spi.db.PropertyGetterBase.verifyWrapperType; /** * JAXBWrapperAccessor @@ -58,6 +60,7 @@ protected HashMap elementDeclaredTypes; public JAXBWrapperAccessor(Class wrapperBean) { + verifyWrapperType(wrapperBean); contentClass = (Class) wrapperBean; HashMap setByQName = new HashMap(); @@ -142,18 +145,16 @@ } } - // _return - if (fieldName.startsWith("_") && !localName.startsWith("_")) { - fieldName = fieldName.substring(1); - } - Method setMethod = publicSetters.get(fieldName); - Method getMethod = publicGetters.get(fieldName); - PropertySetter setter = createPropertySetter(field, setMethod); - PropertyGetter getter = createPropertyGetter(field, getMethod); - setByQName.put(qname, setter); - setByLocalpart.put(localName, setter); - getByQName.put(qname, getter); - getByLocalpart.put(localName, getter); + Method setMethod = accessor(publicSetters, fieldName, localName); + Method getMethod = accessor(publicGetters, fieldName, localName); + if ( isProperty(field, getMethod, setMethod) ) { + PropertySetter setter = createPropertySetter(field, setMethod); + PropertyGetter getter = createPropertyGetter(field, getMethod); + setByQName.put(qname, setter); + setByLocalpart.put(localName, setter); + getByQName.put(qname, getter); + getByLocalpart.put(localName, getter); + } } if (this.elementLocalNameCollision) { this.propertySetters = setByQName; @@ -166,7 +167,25 @@ } } - static protected List getAllFields(Class clz) { + static private Method accessor(HashMap map, String fieldName, String localName) { + Method a = map.get(fieldName); + if (a == null) a = map.get(localName); + if (a == null && fieldName.startsWith("_")) a = map.get(fieldName.substring(1)); + return a; + } + + static private boolean isProperty(Field field, Method getter, Method setter) { + if (java.lang.reflect.Modifier.isPublic(field.getModifiers())) return true; + if (getter == null) return false; + if (setter == null) { + return java.util.Collection.class.isAssignableFrom(field.getType()) || + java.util.Map.class.isAssignableFrom(field.getType()) ; + } else { + return true; + } + } + + static private List getAllFields(Class clz) { List list = new ArrayList(); while (!Object.class.equals(clz)) { list.addAll(Arrays.asList(getDeclaredFields(clz))); @@ -175,23 +194,20 @@ return list; } - static protected Field[] getDeclaredFields(final Class clz) { + static private Field[] getDeclaredFields(final Class clz) { try { - return (System.getSecurityManager() == null) ? clz .getDeclaredFields() : - AccessController.doPrivileged(new PrivilegedExceptionAction() { + return AccessController.doPrivileged(new PrivilegedExceptionAction() { @Override public Field[] run() throws IllegalAccessException { return clz.getDeclaredFields(); } }); } catch (PrivilegedActionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return null; + throw new WebServiceException(e); } } - static protected PropertyGetter createPropertyGetter(Field field, Method getMethod) { + static private PropertyGetter createPropertyGetter(Field field, Method getMethod) { if (!field.isAccessible()) { if (getMethod != null) { MethodGetter methodGetter = new MethodGetter(getMethod); @@ -200,10 +216,10 @@ } } } - return new FieldGetter(field); + return new PrivFieldGetter(field); } - static protected PropertySetter createPropertySetter(Field field, + static private PropertySetter createPropertySetter(Field field, Method setter) { if (!field.isAccessible()) { if (setter != null) { @@ -213,7 +229,7 @@ } } } - return new FieldSetter(field); + return new PrivFieldSetter(field); } private Class getElementDeclaredType(QName name) { @@ -238,10 +254,10 @@ public Object get(Object bean) throws DatabindingException { Object val; if (isJAXBElement) { - JAXBElement jaxbElement = (JAXBElement) getter.get(bean); + JAXBElement jaxbElement = (JAXBElement) JAXBWrapperAccessor.get(getter, bean); val = (jaxbElement == null) ? null : jaxbElement.getValue(); } else { - val = getter.get(bean); + val = JAXBWrapperAccessor.get(getter, bean); } if (val == null && isListType) { val = new java.util.ArrayList(); @@ -255,11 +271,95 @@ if (isJAXBElement) { JAXBElement jaxbElement = new JAXBElement( n, elementDeclaredType, contentClass, value); - setter.set(bean, jaxbElement); + JAXBWrapperAccessor.set(setter, bean, jaxbElement); } else { - setter.set(bean, value); + JAXBWrapperAccessor.set(setter, bean, value); } } }; } + + static private Object get(PropertyGetter getter, Object wrapperInstance) { + return (getter instanceof PrivFieldGetter)? + ((PrivFieldGetter)getter).getPriv(wrapperInstance): + getter.get(wrapperInstance); + } + + static private void set(PropertySetter setter, Object wrapperInstance, Object value) { + if (setter instanceof PrivFieldSetter) + ((PrivFieldSetter)setter).setPriv(wrapperInstance, value); + else + setter.set(wrapperInstance, value); + } + + + static private class PrivFieldSetter extends FieldSetter { + private PrivFieldSetter(Field f) { + super(f); + } + private void setPriv(final Object instance, final Object val) { + final Object resource = (type.isPrimitive() && val == null)? uninitializedValue(type): val; + if (field.isAccessible()) { + try { + field.set(instance, resource); + } catch (Exception e) { + throw new WebServiceException(e); + } + } else { + try { + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IllegalAccessException { + if (!field.isAccessible()) { + field.setAccessible(true); + } + field.set(instance, resource); + return null; + } + }); + } catch (PrivilegedActionException e) { + throw new WebServiceException(e); + } + } + } + } + + static private class PrivFieldGetter extends FieldGetter { + private PrivFieldGetter(Field f) { + super(f); + } + static private class PrivilegedGetter implements PrivilegedExceptionAction { + private Object value; + private Field field; + private Object instance; + public PrivilegedGetter(Field field, Object instance) { + super(); + this.field = field; + this.instance = instance; + } + public Object run() throws IllegalAccessException { + if (!field.isAccessible()) { + field.setAccessible(true); + } + value = field.get(instance); + return null; + } + } + private Object getPriv(final Object instance) { + if (field.isAccessible()) { + try { + return field.get(instance); + } catch (Exception e) { + throw new WebServiceException(e); + } + } else { + PrivilegedGetter privilegedGetter = new PrivilegedGetter(field, instance); + try { + AccessController.doPrivileged(privilegedGetter); + } catch (PrivilegedActionException e) { + throw new WebServiceException(e); + } + return privilegedGetter.value; + } + } + } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/MethodGetter.java 2014-03-28 17:28:49.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/MethodGetter.java 2014-03-28 17:28:49.000000000 +0100 @@ -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 @@ -26,9 +26,7 @@ package com.sun.xml.internal.ws.spi.db; import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; +import javax.xml.ws.WebServiceException; /** @@ -41,6 +39,7 @@ private Method method; public MethodGetter(Method m) { + verifyWrapperType(m.getDeclaringClass()); method = m; type = m.getReturnType(); } @@ -54,49 +53,12 @@ return (A) method.getAnnotation(c); } - - static class PrivilegedGetter implements PrivilegedExceptionAction { - private Object value; - private Method method; - private Object instance; - public PrivilegedGetter(Method m, Object instance) { - super(); - this.method = m; - this.instance = instance; - } - public Object run() throws IllegalAccessException { - if (!method.isAccessible()) { - method.setAccessible(true); - } - try { - value = method.invoke(instance, new Object[0]); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - } - public Object get(final Object instance) { final Object[] args = new Object[0]; try { - if (method.isAccessible()) { - return method.invoke(instance, args); - } else { - PrivilegedGetter privilegedGetter = new PrivilegedGetter(method, instance); - try { - AccessController.doPrivileged(privilegedGetter); - } catch (PrivilegedActionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return privilegedGetter.value; - } + return method.invoke(instance, args); } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + throw new WebServiceException(e); } - return null; } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/MethodSetter.java 2014-03-28 17:28:50.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/MethodSetter.java 2014-03-28 17:28:50.000000000 +0100 @@ -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 @@ -25,10 +25,9 @@ package com.sun.xml.internal.ws.spi.db; +import static com.sun.xml.internal.ws.spi.db.PropertyGetterBase.verifyWrapperType; import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; +import javax.xml.ws.WebServiceException; /** @@ -41,6 +40,7 @@ private Method method; public MethodSetter(Method m) { + verifyWrapperType(m.getDeclaringClass()); method = m; type = m.getParameterTypes()[0]; } @@ -54,34 +54,13 @@ return (A) method.getAnnotation(c); } - public void set(final Object instance, Object resource) { + public void set(final Object instance, Object val) { + final Object resource = (type.isPrimitive() && val == null)? uninitializedValue(type): val; final Object[] args = {resource}; - if (method.isAccessible()) { - try { - method.invoke(instance, args); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws IllegalAccessException { - if (!method.isAccessible()) { - method.setAccessible(true); - } - try { - method.invoke(instance, args); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - }); - } catch (PrivilegedActionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + method.invoke(instance, args); + } catch (Exception e) { + throw new WebServiceException(e); } } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/PropertyGetterBase.java 2014-03-28 17:28:50.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/PropertyGetterBase.java 2014-03-28 17:28:50.000000000 +0100 @@ -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 @@ -25,6 +25,8 @@ package com.sun.xml.internal.ws.spi.db; +import javax.xml.ws.WebServiceException; + /** * This is the Gtter of a bean property. * @@ -46,7 +48,7 @@ method.getName().length() > 3) { return true; } else { - if (method.getReturnType().equals(boolean.class) && + if ((method.getReturnType().equals(boolean.class) || method.getReturnType().equals(Boolean.class)) && method.getName().startsWith("is") && method.getName().length() > 2) { return true; @@ -55,4 +57,11 @@ } return false; } + + static void verifyWrapperType(Class wrapperType) { + String className = wrapperType.getName(); + if (className.startsWith("java.") || className.startsWith("javax.")) { + throw new WebServiceException("Invalid wrapper type " + className); + } + } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/PropertySetterBase.java 2014-03-28 17:28:51.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/PropertySetterBase.java 2014-03-28 17:28:50.000000000 +0100 @@ -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 @@ -25,6 +25,9 @@ package com.sun.xml.internal.ws.spi.db; +import java.util.HashMap; +import java.util.Map; + /** * This is the Setter of a bean property. * @author shih-chang.chen@oracle.com @@ -44,4 +47,20 @@ method.getParameterTypes() != null && method.getParameterTypes().length == 1); } + + /** + * Uninitialized map keyed by their classes. + */ + private static final Map uninitializedValues = new HashMap(); + static { + uninitializedValues.put(byte.class, Byte.valueOf((byte) 0)); + uninitializedValues.put(boolean.class, false); + uninitializedValues.put(char.class, Character.valueOf((char) 0)); + uninitializedValues.put(float.class, Float.valueOf(0)); + uninitializedValues.put(double.class, Double.valueOf(0)); + uninitializedValues.put(int.class, Integer.valueOf(0)); + uninitializedValues.put(long.class, Long.valueOf(0)); + uninitializedValues.put(short.class, Short.valueOf((short) 0)); + } + static protected Object uninitializedValue(Class cls) { return uninitializedValues.get(cls); } } --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/streaming/MtomStreamWriter.java 2014-03-28 17:28:51.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/streaming/MtomStreamWriter.java 2014-03-28 17:28:51.000000000 +0100 @@ -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 @@ -36,9 +36,12 @@ * {@link AttachmentMarshaller}. The marshaller could do processing based on * MTOM threshold, and make decisions about inlining the attachment data or not. * + * * @author Jitendra Kotamraju * @see JAXBMessage * @see MtomCodec + * + * @deprecated use com.sun.xml.internal.org.jvnet.staxex.util.MtomStreamWriter */ public interface MtomStreamWriter { AttachmentMarshaller getAttachmentMarshaller(); --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/HttpAdapter.java 2014-03-28 17:28:51.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/HttpAdapter.java 2014-03-28 17:28:51.000000000 +0100 @@ -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 @@ -32,11 +32,14 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.HttpURLConnection; +import java.util.AbstractMap; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -172,43 +175,187 @@ * * @param sdef service definition */ - public final void initWSDLMap(ServiceDefinition sdef) { - this.serviceDefinition = sdef; - if(sdef==null) { + public final void initWSDLMap(final ServiceDefinition serviceDefinition) { + this.serviceDefinition = serviceDefinition; + if(serviceDefinition==null) { wsdls = Collections.emptyMap(); revWsdls = Collections.emptyMap(); } else { - wsdls = new HashMap(); // wsdl=1 --> Doc - // Sort WSDL, Schema documents based on SystemId so that the same - // document gets wsdl=x mapping - Map systemIds = new TreeMap(); - for (SDDocument sdd : sdef) { - if (sdd == sdef.getPrimary()) { // No sorting for Primary WSDL - wsdls.put("wsdl", sdd); - wsdls.put("WSDL", sdd); - } else { - systemIds.put(sdd.getURL().toString(), sdd); + wsdls = new AbstractMap() { + private Map delegate = null; + + private synchronized Map delegate() { + if (delegate != null) + return delegate; + + delegate = new HashMap(); // wsdl=1 --> Doc + // Sort WSDL, Schema documents based on SystemId so that the same + // document gets wsdl=x mapping + Map systemIds = new TreeMap(); + for (SDDocument sdd : serviceDefinition) { + if (sdd == serviceDefinition.getPrimary()) { // No sorting for Primary WSDL + delegate.put("wsdl", sdd); + delegate.put("WSDL", sdd); + } else { + systemIds.put(sdd.getURL().toString(), sdd); + } + } + + int wsdlnum = 1; + int xsdnum = 1; + for (Entry e : systemIds.entrySet()) { + SDDocument sdd = e.getValue(); + if (sdd.isWSDL()) { + delegate.put("wsdl="+(wsdlnum++),sdd); + } + if (sdd.isSchema()) { + delegate.put("xsd="+(xsdnum++),sdd); + } + } + + return delegate; + } + + @Override + public void clear() { + delegate().clear(); } - } - int wsdlnum = 1; - int xsdnum = 1; - for (Entry e : systemIds.entrySet()) { - SDDocument sdd = e.getValue(); - if (sdd.isWSDL()) { - wsdls.put("wsdl="+(wsdlnum++),sdd); + @Override + public boolean containsKey(Object arg0) { + return delegate().containsKey(arg0); } - if (sdd.isSchema()) { - wsdls.put("xsd="+(xsdnum++),sdd); + + @Override + public boolean containsValue(Object arg0) { + return delegate.containsValue(arg0); } - } - revWsdls = new HashMap(); // Doc --> wsdl=1 - for (Entry e : wsdls.entrySet()) { - if (!e.getKey().equals("WSDL")) { // map Doc --> wsdl, not WSDL - revWsdls.put(e.getValue(),e.getKey()); + @Override + public SDDocument get(Object arg0) { + return delegate().get(arg0); } - } + + @Override + public boolean isEmpty() { + return delegate().isEmpty(); + } + + @Override + public Set keySet() { + return delegate().keySet(); + } + + @Override + public SDDocument put(String arg0, SDDocument arg1) { + return delegate().put(arg0, arg1); + } + + @Override + public void putAll( + Map arg0) { + delegate().putAll(arg0); + } + + @Override + public SDDocument remove(Object arg0) { + return delegate().remove(arg0); + } + + @Override + public int size() { + return delegate().size(); + } + + @Override + public Collection values() { + return delegate().values(); + } + + @Override + public Set> entrySet() { + return delegate().entrySet(); + } + }; + + revWsdls = new AbstractMap() { + private Map delegate = null; + + private synchronized Map delegate() { + if (delegate != null) + return delegate; + + delegate = new HashMap(); // Doc --> wsdl=1 + for (Entry e : wsdls.entrySet()) { + if (!e.getKey().equals("WSDL")) { // map Doc --> wsdl, not WSDL + delegate.put(e.getValue(),e.getKey()); + } + } + + return delegate; + } + + @Override + public void clear() { + delegate().clear(); + } + + @Override + public boolean containsKey(Object key) { + return delegate().containsKey(key); + } + + @Override + public boolean containsValue(Object value) { + return delegate().containsValue(value); + } + + @Override + public Set> entrySet() { + return delegate().entrySet(); + } + + @Override + public String get(Object key) { + return delegate().get(key); + } + + @Override + public boolean isEmpty() { + // TODO Auto-generated method stub + return super.isEmpty(); + } + + @Override + public Set keySet() { + return delegate().keySet(); + } + + @Override + public String put(SDDocument key, String value) { + return delegate().put(key, value); + } + + @Override + public void putAll(Map m) { + delegate().putAll(m); + } + + @Override + public String remove(Object key) { + return delegate().remove(key); + } + + @Override + public int size() { + return delegate().size(); + } + + @Override + public Collection values() { + return delegate().values(); + } + }; } } @@ -981,7 +1128,9 @@ } } try { - setPublishStatus(Boolean.getBoolean(HttpAdapter.class.getName() + ".publishStatusPage")); + if (System.getProperty(HttpAdapter.class.getName() + ".publishStatusPage") != null) { + setPublishStatus(Boolean.getBoolean(HttpAdapter.class.getName() + ".publishStatusPage")); + } } catch (SecurityException se) { if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.", --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/client/HttpTransportPipe.java 2014-03-28 17:28:52.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/client/HttpTransportPipe.java 2014-03-28 17:28:52.000000000 +0100 @@ -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 @@ -257,7 +257,14 @@ // Allows only certain http status codes for a binding. For all // other status codes, throws exception checkStatusCode(responseStream, con); // throws ClientTransportException - + //To avoid zero-length chunk for One-Way + if (cl ==-1 && con.statusCode == 202 && "Accepted".equals(con.statusMessage) && responseStream != null) { + ByteArrayBuffer buf = new ByteArrayBuffer(); + buf.write(responseStream); //What is within the responseStream? + responseStream.close(); + responseStream = (buf.size()==0)? null : buf.newInputStream(); + buf.close(); + } Packet reply = request.createClientResponse(null); reply.wasTransportSecure = con.isSecure(); if (responseStream != null) { --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/util/version.properties 2014-03-28 17:28:52.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/util/version.properties 2014-03-28 17:28:52.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 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 @@ -23,7 +23,7 @@ # questions. # -build-id=2.2.9-b130926.1035 -build-version=JAX-WS RI 2.2.9-b130926.1035 -major-version=2.2.9 -svn-revision=8c29a9a53251ff741fca1664a8221dc876b2eac8 +build-id=2.2.10-b140228.1436 +build-version=JAX-WS RI 2.2.10-b140228.1436 +major-version=2.2.10 +svn-revision=e1d4708e8a2aee1ae9d38313452e14ce4b67851a --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java 2014-03-28 17:28:53.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java 2014-03-28 17:28:53.000000000 +0100 @@ -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 @@ -48,6 +48,8 @@ * * @author Kohsuke Kawaguchi * @author Ryan Shoemaker + * + * @deprecated use com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter */ public class XMLStreamReaderToXMLStreamWriter { --- old/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/writer/WSDLPatcher.java 2014-03-28 17:28:53.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/writer/WSDLPatcher.java 2014-03-28 17:28:53.000000000 +0100 @@ -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 @@ -27,7 +27,7 @@ import com.sun.istack.internal.NotNull; import com.sun.xml.internal.ws.api.server.PortAddressResolver; -import com.sun.xml.internal.ws.util.xml.XMLStreamReaderToXMLStreamWriter; +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants; import com.sun.xml.internal.ws.addressing.W3CAddressingConstants; import com.sun.xml.internal.ws.addressing.v200408.MemberSubmissionAddressingConstants; --- old/src/share/jaxws_classes/javax/xml/bind/JAXBException.java 2014-03-28 17:28:54.000000000 +0100 +++ new/src/share/jaxws_classes/javax/xml/bind/JAXBException.java 2014-03-28 17:28:54.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -48,7 +48,7 @@ * Exception reference * */ - private volatile Throwable linkedException; + private Throwable linkedException; static final long serialVersionUID = -5621384651494307979L; @@ -133,7 +133,7 @@ * indicates that the linked exception does not exist or * is unknown). */ - public void setLinkedException( Throwable exception ) { + public synchronized void setLinkedException( Throwable exception ) { this.linkedException = exception; } --- old/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java 2014-03-28 17:28:54.000000000 +0100 +++ new/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java 2014-03-28 17:28:54.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -57,9 +57,8 @@ * Exception reference * */ - private volatile Throwable linkedException; + private Throwable linkedException; - static final long serialVersionUID = -3059799699420143848L; /** * Construct a TypeConstraintException with the specified detail message. The @@ -142,7 +141,7 @@ * indicates that the linked exception does not exist or * is unknown). */ - public void setLinkedException( Throwable exception ) { + public synchronized void setLinkedException( Throwable exception ) { this.linkedException = exception; } --- /dev/null 2014-03-28 17:28:55.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/codemodel/internal/writer/OutputStreamCodeWriter.java 2014-03-28 17:28:55.000000000 +0100 @@ -0,0 +1,73 @@ +/* + * 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 + * 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. + */ + +/** + * Output all source files into a single stream. + * + * This is primarily for test purposes. + * + * @author + * Aleksei Valikov (valikov@gmx.net) + */ +package com.sun.codemodel.internal.writer; + +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.UnsupportedEncodingException; + +import com.sun.codemodel.internal.CodeWriter; +import com.sun.codemodel.internal.JPackage; + +public class OutputStreamCodeWriter extends CodeWriter { + private final PrintStream out; + + /** + * @param os + * This stream will be closed at the end of the code generation. + */ + public OutputStreamCodeWriter(OutputStream os, String encoding) { + try { + this.out = new PrintStream(os, false, encoding); + } catch (UnsupportedEncodingException ueex) { + throw new IllegalArgumentException(ueex); + } + this.encoding = encoding; + } + + public OutputStream openBinary(JPackage pkg, String fileName) + throws IOException { + return new FilterOutputStream(out) { + public void close() { + // don't let this stream close + } + }; + } + + public void close() throws IOException { + out.close(); + } +} --- /dev/null 2014-03-28 17:28:55.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/LazyEnvelopeSource.java 2014-03-28 17:28:55.000000000 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 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 + * 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.messaging.saaj; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +/** + * LazyEnvelopeSource provides the source to create lazy Envelope + * + * @author shih-chang.chen@oracle.com + */ +public interface LazyEnvelopeSource extends javax.xml.transform.Source { + /** + * Retrieve payload qname without materializing its contents + * @return + * @throws SOAPException + */ + public QName getPayloadQName(); + public XMLStreamReader readToBodyStarTag() throws XMLStreamException; + public XMLStreamReader readPayload(); + public void writePayloadTo(XMLStreamWriter writer)throws XMLStreamException; + public boolean isPayloadStreamReader(); +} --- /dev/null 2014-03-28 17:28:55.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/LazyEnvelope.java 2014-03-28 17:28:55.000000000 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2005, 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 + * 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.messaging.saaj.soap; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +public interface LazyEnvelope extends Envelope { + public XMLStreamReader getPayloadReader() throws SOAPException; + public boolean isLazy(); + public void writeTo(XMLStreamWriter writer) throws XMLStreamException, SOAPException; + + /** + * Retrieve payload qname without materializing its contents + * @return + * @throws SOAPException + */ + public QName getPayloadQName() throws SOAPException; + + /** + * Retrieve payload attribute value without materializing its contents + * @param localName + * @return + * @throws SOAPException + */ + public String getPayloadAttributeValue(String localName) throws SOAPException; + + /** + * Retrieve payload attribute value without materializing its contents + * @param qName + * @return + * @throws SOAPException + */ + public String getPayloadAttributeValue(QName qName) throws SOAPException; +} --- /dev/null 2014-03-28 17:28:56.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxBridge.java 2014-03-28 17:28:56.000000000 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 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 + * 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.messaging.saaj.soap; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter; +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; + + +/** + * StaxBridge builds Envelope using a XMLStreamReaderToXMLStreamWriter + * + * @author shih-chang.chen@oracle.com + */ +public abstract class StaxBridge { + protected SaajStaxWriter saajWriter; + protected XMLStreamReaderToXMLStreamWriter readerToWriter; + protected XMLStreamReaderToXMLStreamWriter.Breakpoint breakpoint; + + + public StaxBridge(SOAPPartImpl soapPart) throws SOAPException { + readerToWriter = new XMLStreamReaderToXMLStreamWriter(); + saajWriter = new SaajStaxWriter(soapPart.message, soapPart.getSOAPNamespace()); + } + + public void bridgeEnvelopeAndHeaders() throws XMLStreamException { + readerToWriter.bridge(breakpoint); + } + + public void bridgePayload() throws XMLStreamException { + readerToWriter.bridge(breakpoint); + } + + abstract public XMLStreamReader getPayloadReader(); + + abstract public QName getPayloadQName(); + + abstract public String getPayloadAttributeValue(String attName) ; + + abstract public String getPayloadAttributeValue(QName attName) ; +} --- /dev/null 2014-03-28 17:28:56.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxLazySourceBridge.java 2014-03-28 17:28:56.000000000 +0100 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 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 + * 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.messaging.saaj.soap; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import com.sun.xml.internal.messaging.saaj.LazyEnvelopeSource; +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; + + +/** + * StaxBridge builds Envelope from LazyEnvelopeSource + * + * @author shih-chang.chen@oracle.com + */ +public class StaxLazySourceBridge extends StaxBridge { + private LazyEnvelopeSource lazySource; + + public StaxLazySourceBridge(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException { + super(soapPart); + lazySource = src; + final String soapEnvNS = soapPart.getSOAPNamespace(); + try { + breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(src.readToBodyStarTag(), saajWriter) { + public boolean proceedAfterStartElement() { + if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){ + return false; + } else + return true; + } + }; + } catch (XMLStreamException e) { + throw new SOAPException(e); + } + } + + @Override + public XMLStreamReader getPayloadReader() { + return lazySource.readPayload(); +// throw new UnsupportedOperationException(); + } + + @Override + public QName getPayloadQName() { + return lazySource.getPayloadQName(); + } + + @Override + public String getPayloadAttributeValue(String attName) { + if (lazySource.isPayloadStreamReader()) { + XMLStreamReader reader = lazySource.readPayload(); + if (reader.getEventType() == reader.START_ELEMENT) { + return reader.getAttributeValue(null, attName); + } + } + return null; + } + + @Override + public String getPayloadAttributeValue(QName attName) { + if (lazySource.isPayloadStreamReader()) { + XMLStreamReader reader = lazySource.readPayload(); + if (reader.getEventType() == reader.START_ELEMENT) { + return reader.getAttributeValue(attName.getNamespaceURI(), attName.getLocalPart()); + } + } + return null; + } + + public void bridgePayload() throws XMLStreamException { + //Assuming out is at Body + writePayloadTo(saajWriter); + } + + public void writePayloadTo(XMLStreamWriter writer) throws XMLStreamException { + lazySource.writePayloadTo(writer); + } +} --- /dev/null 2014-03-28 17:28:57.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxReaderBridge.java 2014-03-28 17:28:56.000000000 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 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 + * 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.messaging.saaj.soap; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.stream.XMLStreamReader; + +import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter; + +/** + * StaxBridge builds Envelope using a XMLStreamReaderToXMLStreamWriter + * + * @author shih-chang.chen@oracle.com + */ +public class StaxReaderBridge extends StaxBridge { + private XMLStreamReader in; + + public StaxReaderBridge(XMLStreamReader reader, SOAPPartImpl soapPart) throws SOAPException { + super(soapPart); + in = reader; + final String soapEnvNS = soapPart.getSOAPNamespace(); + breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, saajWriter) { + boolean seenBody = false; + boolean stopedAtBody = false; + public boolean proceedBeforeStartElement() { + if (stopedAtBody) return true; + if (seenBody) { + stopedAtBody = true; + return false; + } + if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){ + seenBody = true; + } + return true; + } + }; + } + + public XMLStreamReader getPayloadReader() { + return in; + } + + public QName getPayloadQName() { + return (in.getEventType() == in.START_ELEMENT) ? in.getName() : null; + } + + public String getPayloadAttributeValue(String attName) { + return (in.getEventType() == in.START_ELEMENT) ? in.getAttributeValue(null, attName) : null; + } + + public String getPayloadAttributeValue(QName attName) { + return (in.getEventType() == in.START_ELEMENT) ? in.getAttributeValue(attName.getNamespaceURI(), attName.getLocalPart()) : null; + } +} --- /dev/null 2014-03-28 17:28:57.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPCommentImpl.java 2014-03-28 17:28:57.000000000 +0100 @@ -0,0 +1,114 @@ +/* + * 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 + * 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.messaging.saaj.soap.impl; + +import java.util.ResourceBundle; +import java.util.logging.Logger; + +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPException; + +import org.w3c.dom.DOMException; +import org.w3c.dom.Text; + +import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; +import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants; + +public class SOAPCommentImpl + extends com.sun.org.apache.xerces.internal.dom.CommentImpl + implements javax.xml.soap.Text, org.w3c.dom.Comment { + + protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); + protected static ResourceBundle rb = + log.getResourceBundle(); + + public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, String text) { + super(ownerDoc, text); + } + + public String getValue() { + String nodeValue = getNodeValue(); + return (nodeValue.equals("") ? null : nodeValue); + } + + public void setValue(String text) { + setNodeValue(text); + } + + + public void setParentElement(SOAPElement element) throws SOAPException { + if (element == null) { + log.severe("SAAJ0112.impl.no.null.to.parent.elem"); + throw new SOAPException("Cannot pass NULL to setParentElement"); + } + ((ElementImpl) element).addNode(this); + } + + public SOAPElement getParentElement() { + return (SOAPElement) getParentNode(); + } + + public void detachNode() { + org.w3c.dom.Node parent = getParentNode(); + if (parent != null) { + parent.removeChild(this); + } + } + + public void recycleNode() { + detachNode(); + // TBD + // - add this to the factory so subsequent + // creations can reuse this object. + } + + public boolean isComment() { + return true; + } + + public Text splitText(int offset) throws DOMException { + log.severe("SAAJ0113.impl.cannot.split.text.from.comment"); + throw new UnsupportedOperationException("Cannot split text from a Comment Node."); + } + + public Text replaceWholeText(String content) throws DOMException { + log.severe("SAAJ0114.impl.cannot.replace.wholetext.from.comment"); + throw new UnsupportedOperationException("Cannot replace Whole Text from a Comment Node."); + } + + public String getWholeText() { + //TODO: maybe we have to implement this in future. + throw new UnsupportedOperationException("Not Supported"); + } + + public boolean isElementContentWhitespace() { + //TODO: maybe we have to implement this in future. + throw new UnsupportedOperationException("Not Supported"); + } + +} --- /dev/null 2014-03-28 17:28:57.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPTextImpl.java 2014-03-28 17:28:57.000000000 +0100 @@ -0,0 +1,91 @@ +/* + * 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 + * 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.messaging.saaj.soap.impl; + +import java.util.logging.Logger; + +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPException; + +import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; +import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants; + +public class SOAPTextImpl + extends com.sun.org.apache.xerces.internal.dom.TextImpl + implements javax.xml.soap.Text, org.w3c.dom.Text { + + protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); + + public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) { + super(ownerDoc, text); + } + + public String getValue() { + String nodeValue = getNodeValue(); + return (nodeValue.equals("") ? null : nodeValue); + } + + public void setValue(String text) { + setNodeValue(text); + } + + public void setParentElement(SOAPElement parent) throws SOAPException { + if (parent == null) { + log.severe("SAAJ0126.impl.cannot.locate.ns"); + throw new SOAPException("Cannot pass NULL to setParentElement"); + } + ((ElementImpl) parent).addNode(this); + } + + public SOAPElement getParentElement() { + return (SOAPElement) getParentNode(); + } + + + public void detachNode() { + org.w3c.dom.Node parent = getParentNode(); + if (parent != null) { + parent.removeChild(this); + } + } + + public void recycleNode() { + detachNode(); + // TBD + // - add this to the factory so subsequent + // creations can reuse this object. + } + + public boolean isComment() { + String txt = getNodeValue(); + if (txt == null) { + return false; + } + return txt.startsWith(""); + } +} --- /dev/null 2014-03-28 17:28:58.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/LazyEnvelopeStaxReader.java 2014-03-28 17:28:57.000000000 +0100 @@ -0,0 +1,359 @@ +/* + * Copyright (c) 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 + * 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.messaging.saaj.util.stax; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.w3c.dom.Node; + +import com.sun.xml.internal.messaging.saaj.soap.impl.BodyImpl; +import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl; + +/** + * "Hybrid" reader which + * @author desagar + * + */ +public class LazyEnvelopeStaxReader extends com.sun.xml.internal.org.jvnet.staxex.util.DOMStreamReader { +// EnvelopeImpl env; + XMLStreamReader payloadReader = null; + boolean usePayloadReaderDelegate = false; + private QName bodyQName; + + public LazyEnvelopeStaxReader(EnvelopeImpl env) throws SOAPException, XMLStreamException { + super(env); +// this.env = env; + bodyQName = new QName(env.getNamespaceURI(), "Body"); + payloadReader = env.getStaxBridge().getPayloadReader(); + int eventType = getEventType(); + while (eventType != START_ELEMENT) { + eventType = nextTag(); + } + } + + public Object getProperty(String name) throws IllegalArgumentException { + if (usePayloadReaderDelegate) return payloadReader.getProperty(name); + return super.getProperty(name); + } + + public int next() throws XMLStreamException { +// boolean previouslyUsingPayloadReader = usePayloadReaderDelegate; + //call checkReaderStatus to advance to payloadReader if needed + checkReaderStatus(true); + + if (usePayloadReaderDelegate) return payloadReader.getEventType(); + + //if we just moved to payload reader, don't advance the pointer +// if (usePayloadReaderDelegate && !previouslyUsingPayloadReader) return payloadReader.getEventType(); + +// if (usePayloadReaderDelegate) return payloadReader.next(); + return getEventType(); + } + + public void require(int type, String namespaceURI, String localName) + throws XMLStreamException { + if (usePayloadReaderDelegate) payloadReader.require(type, namespaceURI, localName); + else super.require(type, namespaceURI, localName); + } + + public String getElementText() throws XMLStreamException { + if (usePayloadReaderDelegate) return payloadReader.getElementText(); + return super.getElementText(); + } + + public int nextTag() throws XMLStreamException { + if (usePayloadReaderDelegate) return payloadReader.nextTag(); + return super.nextTag(); + } + + public boolean hasNext() throws XMLStreamException { + checkReaderStatus(false); + boolean hasNext; + if (usePayloadReaderDelegate) { + hasNext = payloadReader.hasNext(); + } else { + hasNext = super.hasNext(); + } + + /*if (!hasNext && payloadReader != null) { + usePayloadReaderDelegate = true; + hasNext = payloadReader.hasNext(); + }*/ + return hasNext; + } + + private void checkReaderStatus(boolean advanceToNext) throws XMLStreamException { + //if we are using payloadReader, make sure it is not exhausted + //if it is, return to DOM based reader for remaining end elements (body and envelope) + if (usePayloadReaderDelegate) { + if (!payloadReader.hasNext()) { + usePayloadReaderDelegate = false; + } + } else if (START_ELEMENT == getEventType()) { + //if not on payload reader, check if we need to switch to payload reader + + //if the current event is the SOAP body element start, + //and the body is lazy, switch to the payload reader + if (bodyQName.equals(getName())) { + //if we are just switching to payload reader, don't advance...payload reader + //will already be on the first payload element + usePayloadReaderDelegate = true; + advanceToNext = false; + } + } + + if (advanceToNext) { + if (usePayloadReaderDelegate) { + payloadReader.next(); + } else { + super.next(); + } + } + } + + public void close() throws XMLStreamException { + if (usePayloadReaderDelegate) payloadReader.close(); + else super.close(); + } + + public String getNamespaceURI(String prefix) { + if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(prefix); + return super.getNamespaceURI(prefix); + } + + public boolean isStartElement() { + if (usePayloadReaderDelegate) return payloadReader.isStartElement(); + return super.isStartElement(); + } + + public boolean isEndElement() { + if (usePayloadReaderDelegate) return payloadReader.isEndElement(); + return super.isEndElement(); + } + + public boolean isCharacters() { + if (usePayloadReaderDelegate) return payloadReader.isCharacters(); + return super.isEndElement(); + } + + public boolean isWhiteSpace() { + if (usePayloadReaderDelegate) return payloadReader.isWhiteSpace(); + return super.isWhiteSpace(); + } + + public String getAttributeValue(String namespaceURI, String localName) { + if (usePayloadReaderDelegate) return payloadReader.getAttributeValue(namespaceURI, localName); + return super.getAttributeValue(namespaceURI, localName); + } + + public int getAttributeCount() { + if (usePayloadReaderDelegate) return payloadReader.getAttributeCount(); + return super.getAttributeCount(); + } + + public QName getAttributeName(int index) { + if (usePayloadReaderDelegate) return payloadReader.getAttributeName(index); + return super.getAttributeName(index); + } + + public String getAttributeNamespace(int index) { + if (usePayloadReaderDelegate) return payloadReader.getAttributeNamespace(index); + return super.getAttributeNamespace(index); + } + + public String getAttributeLocalName(int index) { + if (usePayloadReaderDelegate) return payloadReader.getAttributeLocalName(index); + return super.getAttributeLocalName(index); + } + + public String getAttributePrefix(int index) { + if (usePayloadReaderDelegate) return payloadReader.getAttributePrefix(index); + return super.getAttributePrefix(index); + } + + public String getAttributeType(int index) { + if (usePayloadReaderDelegate) return payloadReader.getAttributeType(index); + return super.getAttributeType(index); + } + + public String getAttributeValue(int index) { + if (usePayloadReaderDelegate) return payloadReader.getAttributeValue(index); + return super.getAttributeValue(index); + } + + public boolean isAttributeSpecified(int index) { + if (usePayloadReaderDelegate) return payloadReader.isAttributeSpecified(index); + return super.isAttributeSpecified(index); + } + + public int getNamespaceCount() { + if (usePayloadReaderDelegate) return payloadReader.getNamespaceCount(); + return super.getNamespaceCount(); + } + + public String getNamespacePrefix(int index) { + if (usePayloadReaderDelegate) return payloadReader.getNamespacePrefix(index); + return super.getNamespacePrefix(index); + } + + public String getNamespaceURI(int index) { + if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(index); + return super.getNamespaceURI(index); + } + + public NamespaceContext getNamespaceContext() { + if (usePayloadReaderDelegate) return payloadReader.getNamespaceContext(); + return super.getNamespaceContext(); + } + + public int getEventType() { + if (usePayloadReaderDelegate) return payloadReader.getEventType(); + return super.getEventType(); + } + + public String getText() { + if (usePayloadReaderDelegate) return payloadReader.getText(); + return super.getText(); + } + + public char[] getTextCharacters() { + if (usePayloadReaderDelegate) return payloadReader.getTextCharacters(); + return super.getTextCharacters(); + } + + public int getTextCharacters(int sourceStart, char[] target, + int targetStart, int length) throws XMLStreamException { + if (usePayloadReaderDelegate) return payloadReader.getTextCharacters(sourceStart, target, targetStart, + length); + return super.getTextCharacters(sourceStart, target, targetStart, length); + } + + public int getTextStart() { + if (usePayloadReaderDelegate) return payloadReader.getTextStart(); + return super.getTextStart(); + } + + public int getTextLength() { + if (usePayloadReaderDelegate) return payloadReader.getTextLength(); + return super.getTextLength(); + } + + public String getEncoding() { + if (usePayloadReaderDelegate) return payloadReader.getEncoding(); + return super.getEncoding(); + } + + public boolean hasText() { + if (usePayloadReaderDelegate) return payloadReader.hasText(); + return super.hasText(); + } + + public Location getLocation() { + if (usePayloadReaderDelegate) return payloadReader.getLocation(); + return super.getLocation(); + } + + public QName getName() { + if (usePayloadReaderDelegate) return payloadReader.getName(); + return super.getName(); + } + + public String getLocalName() { + if (usePayloadReaderDelegate) return payloadReader.getLocalName(); + return super.getLocalName(); + } + + public boolean hasName() { + if (usePayloadReaderDelegate) return payloadReader.hasName(); + return super.hasName(); + } + + public String getNamespaceURI() { + if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(); + return super.getNamespaceURI(); + } + + public String getPrefix() { + if (usePayloadReaderDelegate) return payloadReader.getPrefix(); + return super.getPrefix(); + } + + public String getVersion() { + if (usePayloadReaderDelegate) return payloadReader.getVersion(); + return super.getVersion(); + } + + public boolean isStandalone() { + if (usePayloadReaderDelegate) return payloadReader.isStandalone(); + return super.isStandalone(); + } + + public boolean standaloneSet() { + if (usePayloadReaderDelegate) return payloadReader.standaloneSet(); + return super.standaloneSet(); + } + + public String getCharacterEncodingScheme() { + if (usePayloadReaderDelegate) return payloadReader.getCharacterEncodingScheme(); + return super.getCharacterEncodingScheme(); + } + + public String getPITarget() { + if (usePayloadReaderDelegate) return payloadReader.getPITarget(); + return super.getPITarget(); + } + + public String getPIData() { + if (usePayloadReaderDelegate) return payloadReader.getPIData(); + return super.getPIData(); + } + + //make sure that message is not realized as a result of call + //to getFirstChild + protected Node getFirstChild(Node node) { + if (node instanceof BodyImpl) { + return ((BodyImpl) node).getFirstChildNoMaterialize(); + } else { + return node.getFirstChild(); + } + } + + protected Node getNextSibling(Node node) { + if (node instanceof BodyImpl) { + //body is not expected to have a next sibling - even if it does + //we would have to materialize the node to retrieve it. + //Since we don't want to materialize it right now, just return null + return null; + } + return node.getNextSibling(); + } + +} --- /dev/null 2014-03-28 17:28:58.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/BinaryText.java 2014-03-28 17:28:58.000000000 +0100 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 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 + * 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.org.jvnet.staxex; + +import javax.activation.DataHandler; +import javax.xml.soap.SOAPException; +import javax.xml.soap.Text; + +/** + * BinaryText represents a MTOM attachment. + * + * @author shih-chang.chen@oracle.com + */ +public interface BinaryText extends Text { + public String getHref(); + public DataHandler getDataHandler() throws SOAPException; +} --- /dev/null 2014-03-28 17:28:58.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/MtomEnabled.java 2014-03-28 17:28:58.000000000 +0100 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 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 + * 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.org.jvnet.staxex; + +import javax.activation.DataHandler; + +/** + * A SOAPElement implementation may support this interface to allow MTOM attachments. + * + * @author shih-chang.chen@oracle.com + */ +public interface MtomEnabled { + BinaryText addBinaryText(byte[] bytes); + BinaryText addBinaryText(String contentType, byte[] bytes); + BinaryText addBinaryText(String href, DataHandler dl); +} --- /dev/null 2014-03-28 17:28:59.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StAxSOAPBody.java 2014-03-28 17:28:58.000000000 +0100 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 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 + * 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.org.jvnet.staxex; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +/** + * A StAxSOAPBody is a SOAPBody that allows to be loaded from a StAX style payload. + * + * @author shih-chang.chen@oracle.com + */ +public interface StAxSOAPBody { + + /** + * The StAxSOAPBody represents the StAX source of SOAPBody payload. + */ + public static interface Payload { + + /** + * Retrieve payload qname without materializing its contents + * @return + * @throws SOAPException + */ + public QName getPayloadQName(); + + public XMLStreamReader readPayload() throws XMLStreamException; + + public void writePayloadTo(XMLStreamWriter writer)throws XMLStreamException; + + /** + * Retrieve payload attribute value without materializing its contents + * @param localName + * @return + * @throws SOAPException + */ + public String getPayloadAttributeValue(String localName) throws XMLStreamException; + + /** + * Retrieve payload attribute value without materializing its contents + * @param qName + * @return + * @throws SOAPException + */ + public String getPayloadAttributeValue(QName qName) throws XMLStreamException; + + public void materialize() throws SOAPException; + } + + public void setPayload(Payload src) throws SOAPException; + + public Payload getPayload()throws SOAPException; + + public boolean hasStaxPayload(); + } --- /dev/null 2014-03-28 17:28:59.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/DOMStreamReader.java 2014-03-28 17:28:59.000000000 +0100 @@ -0,0 +1,895 @@ +/* + * 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 + * 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.org.jvnet.staxex.util; + +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import static org.w3c.dom.Node.*; +import org.w3c.dom.ProcessingInstruction; +import org.w3c.dom.Text; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.util.Collections; +import java.util.Iterator; + +/** + * Create an {@link XMLStreamReader} on top of a DOM tree. + * + *

+ * Since various libraries as well as users often create "incorrect" DOM node, + * this class spends a lot of efforts making sure that broken DOM trees are + * nevertheless interpreted correctly. + * + *

+ * For example, if a DOM level + * 1 tree is passed, each method will attempt to return the correct value + * by using {@link Node#getNodeName()}. + * + *

+ * Similarly, if DOM is missing explicit namespace declarations, + * this class attempts to emulate necessary declarations. + * + * + * @author Santiago.PericasGeertsen@sun.com + * @author Kohsuke Kawaguchi + */ +public class DOMStreamReader implements XMLStreamReader, NamespaceContext { + + /** + * Current DOM node being traversed. + */ + protected Node _current; + + /** + * Starting node of the subtree being traversed. + */ + private Node _start; + + /** + * Named mapping for attributes and NS decls for the current node. + */ + private NamedNodeMap _namedNodeMap; + + /** + * If the reader points at {@link #CHARACTERS the text node}, + * its whole value. + * + *

+ * This is simply a cache of {@link Text#getWholeText()} of {@link #_current}, + * but when a large binary data sent as base64 text, this could get very much + * non-trivial. + */ + protected String wholeText; + + /** + * List of attributes extracted from _namedNodeMap. + */ + private final FinalArrayList _currentAttributes = new FinalArrayList(); + + /** + * {@link Scope} buffer. + */ + protected Scope[] scopes = new Scope[8]; + + /** + * Depth of the current element. The first element gets depth==0. + * Also used as the index to {@link #scopes}. + */ + protected int depth = 0; + + /** + * State of this reader. Any of the valid states defined in StAX' + * XMLStreamConstants class. + */ + protected int _state; + + /** + * Namespace declarations on one element. + * + * Instances are reused. + */ + protected static final class Scope { + /** + * Scope for the parent element. + */ + final Scope parent; + + /** + * List of namespace declarations extracted from _namedNodeMap + */ + final FinalArrayList currentNamespaces = new FinalArrayList(); + + /** + * Additional namespace declarations obtained as a result of "fixing" DOM tree, + * which were not part of the original DOM tree. + * + * One entry occupies two spaces (prefix followed by URI.) + */ + final FinalArrayList additionalNamespaces = new FinalArrayList(); + + Scope(Scope parent) { + this.parent = parent; + } + + void reset() { + currentNamespaces.clear(); + additionalNamespaces.clear(); + } + + int getNamespaceCount() { + return currentNamespaces.size()+additionalNamespaces.size()/2; + } + + String getNamespacePrefix(int index) { + int sz = currentNamespaces.size(); + if(index< sz) { + Attr attr = currentNamespaces.get(index); + String result = attr.getLocalName(); + if (result == null) { + result = QName.valueOf(attr.getNodeName()).getLocalPart(); + } + return result.equals("xmlns") ? null : result; + } else { + return additionalNamespaces.get((index-sz)*2); + } + } + + String getNamespaceURI(int index) { + int sz = currentNamespaces.size(); + if(index< sz) { + return currentNamespaces.get(index).getValue(); + } else { + return additionalNamespaces.get((index-sz)*2+1); + } + } + + /** + * Returns the prefix bound to the given URI, or null. + * This method recurses to the parent. + */ + String getPrefix(String nsUri) { + for( Scope sp=this; sp!=null; sp=sp.parent ) { + for( int i=sp.currentNamespaces.size()-1; i>=0; i--) { + String result = getPrefixForAttr(sp.currentNamespaces.get(i),nsUri); + if(result!=null) + return result; + } + for( int i=sp.additionalNamespaces.size()-2; i>=0; i-=2 ) + if(sp.additionalNamespaces.get(i+1).equals(nsUri)) + return sp.additionalNamespaces.get(i); + } + return null; + } + + /** + * Returns the namespace URI bound by the given prefix. + * + * @param prefix + * Prefix to look up. + */ + String getNamespaceURI(String prefix) { + String nsDeclName = prefix.length()==0 ? "xmlns" : "xmlns:"+prefix; + + for( Scope sp=this; sp!=null; sp=sp.parent ) { + for( int i=sp.currentNamespaces.size()-1; i>=0; i--) { + Attr a = sp.currentNamespaces.get(i); + if(a.getNodeName().equals(nsDeclName)) + return a.getValue(); + } + for( int i=sp.additionalNamespaces.size()-2; i>=0; i-=2 ) + if(sp.additionalNamespaces.get(i).equals(prefix)) + return sp.additionalNamespaces.get(i+1); + } + return null; + } + } + + + public DOMStreamReader() { + } + + public DOMStreamReader(Node node) { + setCurrentNode(node); + } + + public void setCurrentNode(Node node) { + scopes[0] = new Scope(null); + depth=0; + + _start = _current = node; + _state = START_DOCUMENT; + // verifyDOMIntegrity(node); + // displayDOM(node, System.out); + } + + public void close() throws XMLStreamException { + } + + /** + * Called when the current node is {@link Element} to look at attribute list + * (which contains both ns decl and attributes in DOM) and split them + * to attributes-proper and namespace decls. + */ + protected void splitAttributes() { + // Clear attribute and namespace lists + _currentAttributes.clear(); + + Scope scope = allocateScope(); + + _namedNodeMap = _current.getAttributes(); + if (_namedNodeMap != null) { + final int n = _namedNodeMap.getLength(); + for (int i = 0; i < n; i++) { + final Attr attr = (Attr) _namedNodeMap.item(i); + final String attrName = attr.getNodeName(); + if (attrName.startsWith("xmlns:") || attrName.equals("xmlns")) { // NS decl? + scope.currentNamespaces.add(attr); + } + else { + _currentAttributes.add(attr); + } + } + } + + // verify that all the namespaces used in element and attributes are indeed available + ensureNs(_current); + for( int i=_currentAttributes.size()-1; i>=0; i-- ) { + Attr a = _currentAttributes.get(i); + if(fixNull(a.getNamespaceURI()).length()>0) + ensureNs(a); // no need to declare "" for attributes in the default namespace + } + } + + /** + * Sub-routine of {@link #splitAttributes()}. + * + *

+ * Makes sure that the namespace URI/prefix used in the given node is available, + * and if not, declare it on the current scope to "fix" it. + * + * It's often common to create DOM trees without putting namespace declarations, + * and this makes sure that such DOM tree will be properly marshalled. + */ + private void ensureNs(Node n) { + String prefix = fixNull(n.getPrefix()); + String uri = fixNull(n.getNamespaceURI()); + + Scope scope = scopes[depth]; + + String currentUri = scope.getNamespaceURI(prefix); + + if(prefix.length()==0) { + currentUri = fixNull(currentUri); + if(currentUri.equals(uri)) + return; // declared correctly + } else { + if(currentUri!=null && currentUri.equals(uri)) + return; // declared correctly + } + + if(prefix.equals("xml") || prefix.equals("xmlns")) + return; // implicitly declared namespaces + + // needs to be declared + scope.additionalNamespaces.add(prefix); + scope.additionalNamespaces.add(uri); + } + + /** + * Allocate new {@link Scope} for {@link #splitAttributes()}. + */ + private Scope allocateScope() { + if(scopes.length==++depth) { + Scope[] newBuf = new Scope[scopes.length*2]; + System.arraycopy(scopes,0,newBuf,0,scopes.length); + scopes = newBuf; + } + Scope scope = scopes[depth]; + if(scope==null) { + scope = scopes[depth] = new Scope(scopes[depth-1]); + } else { + scope.reset(); + } + return scope; + } + + public int getAttributeCount() { + if (_state == START_ELEMENT) + return _currentAttributes.size(); + throw new IllegalStateException("DOMStreamReader: getAttributeCount() called in illegal state"); + } + + /** + * Return an attribute's local name. Handle the case of DOM level 1 nodes. + */ + public String getAttributeLocalName(int index) { + if (_state == START_ELEMENT) { + String localName = _currentAttributes.get(index).getLocalName(); + return (localName != null) ? localName : + QName.valueOf(_currentAttributes.get(index).getNodeName()).getLocalPart(); + } + throw new IllegalStateException("DOMStreamReader: getAttributeLocalName() called in illegal state"); + } + + /** + * Return an attribute's qname. Handle the case of DOM level 1 nodes. + */ + public QName getAttributeName(int index) { + if (_state == START_ELEMENT) { + Node attr = _currentAttributes.get(index); + String localName = attr.getLocalName(); + if (localName != null) { + String prefix = attr.getPrefix(); + String uri = attr.getNamespaceURI(); + return new QName(fixNull(uri), localName, fixNull(prefix)); + } + else { + return QName.valueOf(attr.getNodeName()); + } + } + throw new IllegalStateException("DOMStreamReader: getAttributeName() called in illegal state"); + } + + public String getAttributeNamespace(int index) { + if (_state == START_ELEMENT) { + String uri = _currentAttributes.get(index).getNamespaceURI(); + return fixNull(uri); + } + throw new IllegalStateException("DOMStreamReader: getAttributeNamespace() called in illegal state"); + } + + public String getAttributePrefix(int index) { + if (_state == START_ELEMENT) { + String prefix = _currentAttributes.get(index).getPrefix(); + return fixNull(prefix); + } + throw new IllegalStateException("DOMStreamReader: getAttributePrefix() called in illegal state"); + } + + public String getAttributeType(int index) { + if (_state == START_ELEMENT) { + return "CDATA"; + } + throw new IllegalStateException("DOMStreamReader: getAttributeType() called in illegal state"); + } + + public String getAttributeValue(int index) { + if (_state == START_ELEMENT) { + return _currentAttributes.get(index).getNodeValue(); + } + throw new IllegalStateException("DOMStreamReader: getAttributeValue() called in illegal state"); + } + + public String getAttributeValue(String namespaceURI, String localName) { + if (_state == START_ELEMENT) { + if (_namedNodeMap != null) { + Node attr = _namedNodeMap.getNamedItemNS(namespaceURI, localName); + return attr != null ? attr.getNodeValue() : null; + } + return null; + } + throw new IllegalStateException("DOMStreamReader: getAttributeValue() called in illegal state"); + } + + public String getCharacterEncodingScheme() { + return null; + } + + public String getElementText() throws javax.xml.stream.XMLStreamException { + throw new RuntimeException("DOMStreamReader: getElementText() not implemented"); + } + + public String getEncoding() { + return null; + } + + public int getEventType() { + return _state; + } + + /** + * Return an element's local name. Handle the case of DOM level 1 nodes. + */ + public String getLocalName() { + if (_state == START_ELEMENT || _state == END_ELEMENT) { + String localName = _current.getLocalName(); + return localName != null ? localName : + QName.valueOf(_current.getNodeName()).getLocalPart(); + } + else if (_state == ENTITY_REFERENCE) { + return _current.getNodeName(); + } + throw new IllegalStateException("DOMStreamReader: getAttributeValue() called in illegal state"); + } + + public Location getLocation() { + return DummyLocation.INSTANCE; + } + + /** + * Return an element's qname. Handle the case of DOM level 1 nodes. + */ + public javax.xml.namespace.QName getName() { + if (_state == START_ELEMENT || _state == END_ELEMENT) { + String localName = _current.getLocalName(); + if (localName != null) { + String prefix = _current.getPrefix(); + String uri = _current.getNamespaceURI(); + return new QName(fixNull(uri), localName, fixNull(prefix)); + } + else { + return QName.valueOf(_current.getNodeName()); + } + } + throw new IllegalStateException("DOMStreamReader: getName() called in illegal state"); + } + + public NamespaceContext getNamespaceContext() { + return this; + } + + /** + * Verifies the current state to see if we can return the scope, and do so + * if appropriate. + * + * Used to implement a bunch of StAX API methods that have the same usage restriction. + */ + private Scope getCheckedScope() { + if (_state == START_ELEMENT || _state == END_ELEMENT) { + return scopes[depth]; + } + throw new IllegalStateException("DOMStreamReader: neither on START_ELEMENT nor END_ELEMENT"); + } + + public int getNamespaceCount() { + return getCheckedScope().getNamespaceCount(); + } + + public String getNamespacePrefix(int index) { + return getCheckedScope().getNamespacePrefix(index); + } + + public String getNamespaceURI(int index) { + return getCheckedScope().getNamespaceURI(index); + } + + public String getNamespaceURI() { + if (_state == START_ELEMENT || _state == END_ELEMENT) { + String uri = _current.getNamespaceURI(); + return fixNull(uri); + } + return null; + } + + /** + * This method is not particularly fast, but shouldn't be called very + * often. If we start to use it more, we should keep track of the + * NS declarations using a NamespaceContext implementation instead. + */ + public String getNamespaceURI(String prefix) { + if (prefix == null) { + throw new IllegalArgumentException("DOMStreamReader: getNamespaceURI(String) call with a null prefix"); + } + else if (prefix.equals("xml")) { + return "http://www.w3.org/XML/1998/namespace"; + } + else if (prefix.equals("xmlns")) { + return "http://www.w3.org/2000/xmlns/"; + } + + // check scopes + String nsUri = scopes[depth].getNamespaceURI(prefix); + if(nsUri!=null) return nsUri; + + // then ancestors above start node + Node node = findRootElement(); + String nsDeclName = prefix.length()==0 ? "xmlns" : "xmlns:"+prefix; + while (node.getNodeType() != DOCUMENT_NODE) { + // Is ns declaration on this element? + NamedNodeMap namedNodeMap = node.getAttributes(); + Attr attr = (Attr) namedNodeMap.getNamedItem(nsDeclName); + if (attr != null) + return attr.getValue(); + node = node.getParentNode(); + } + return null; + } + + public String getPrefix(String nsUri) { + if (nsUri == null) { + throw new IllegalArgumentException("DOMStreamReader: getPrefix(String) call with a null namespace URI"); + } + else if (nsUri.equals("http://www.w3.org/XML/1998/namespace")) { + return "xml"; + } + else if (nsUri.equals("http://www.w3.org/2000/xmlns/")) { + return "xmlns"; + } + + // check scopes + String prefix = scopes[depth].getPrefix(nsUri); + if(prefix!=null) return prefix; + + // then ancestors above start node + Node node = findRootElement(); + + while (node.getNodeType() != DOCUMENT_NODE) { + // Is ns declaration on this element? + NamedNodeMap namedNodeMap = node.getAttributes(); + for( int i=namedNodeMap.getLength()-1; i>=0; i-- ) { + Attr attr = (Attr)namedNodeMap.item(i); + prefix = getPrefixForAttr(attr,nsUri); + if(prefix!=null) + return prefix; + } + node = node.getParentNode(); + } + return null; + } + + /** + * Finds the root element node of the traversal. + */ + private Node findRootElement() { + int type; + + Node node = _start; + while ((type = node.getNodeType()) != DOCUMENT_NODE + && type != ELEMENT_NODE) { + node = node.getParentNode(); + } + return node; + } + + /** + * If the given attribute is a namespace declaration for the given namespace URI, + * return its prefix. Otherwise null. + */ + private static String getPrefixForAttr(Attr attr, String nsUri) { + String attrName = attr.getNodeName(); + if (!attrName.startsWith("xmlns:") && !attrName.equals("xmlns")) + return null; // not nsdecl + + if(attr.getValue().equals(nsUri)) { + if(attrName.equals("xmlns")) + return ""; + String localName = attr.getLocalName(); + return (localName != null) ? localName : + QName.valueOf(attrName).getLocalPart(); + } + + return null; + } + + public Iterator getPrefixes(String nsUri) { + // This is an incorrect implementation, + // but AFAIK it's not used in the JAX-WS runtime + String prefix = getPrefix(nsUri); + if(prefix==null) return Collections.emptyList().iterator(); + else return Collections.singletonList(prefix).iterator(); + } + + public String getPIData() { + if (_state == PROCESSING_INSTRUCTION) { + return ((ProcessingInstruction) _current).getData(); + } + return null; + } + + public String getPITarget() { + if (_state == PROCESSING_INSTRUCTION) { + return ((ProcessingInstruction) _current).getTarget(); + } + return null; + } + + public String getPrefix() { + if (_state == START_ELEMENT || _state == END_ELEMENT) { + String prefix = _current.getPrefix(); + return fixNull(prefix); + } + return null; + } + + public Object getProperty(String str) throws IllegalArgumentException { + return null; + } + + public String getText() { + if (_state == CHARACTERS) + return wholeText; + if(_state == CDATA || _state == COMMENT || _state == ENTITY_REFERENCE) + return _current.getNodeValue(); + throw new IllegalStateException("DOMStreamReader: getTextLength() called in illegal state"); + } + + public char[] getTextCharacters() { + return getText().toCharArray(); + } + + public int getTextCharacters(int sourceStart, char[] target, int targetStart, + int targetLength) throws XMLStreamException { + String text = getText(); + int copiedSize = Math.min(targetLength, text.length() - sourceStart); + text.getChars(sourceStart, sourceStart + copiedSize, target, targetStart); + + return copiedSize; + } + + public int getTextLength() { + return getText().length(); + } + + public int getTextStart() { + if (_state == CHARACTERS || _state == CDATA || _state == COMMENT || _state == ENTITY_REFERENCE) { + return 0; + } + throw new IllegalStateException("DOMStreamReader: getTextStart() called in illegal state"); + } + + public String getVersion() { + return null; + } + + public boolean hasName() { + return (_state == START_ELEMENT || _state == END_ELEMENT); + } + + public boolean hasNext() throws javax.xml.stream.XMLStreamException { + return (_state != END_DOCUMENT); + } + + public boolean hasText() { + if (_state == CHARACTERS || _state == CDATA || _state == COMMENT || _state == ENTITY_REFERENCE) { + return getText().trim().length() > 0; + } + return false; + } + + public boolean isAttributeSpecified(int param) { + return false; + } + + public boolean isCharacters() { + return (_state == CHARACTERS); + } + + public boolean isEndElement() { + return (_state == END_ELEMENT); + } + + public boolean isStandalone() { + return true; + } + + public boolean isStartElement() { + return (_state == START_ELEMENT); + } + + public boolean isWhiteSpace() { + if (_state == CHARACTERS || _state == CDATA) + return getText().trim().length()==0; + return false; + } + + private static int mapNodeTypeToState(int nodetype) { + switch (nodetype) { + case CDATA_SECTION_NODE: + return CDATA; + case COMMENT_NODE: + return COMMENT; + case ELEMENT_NODE: + return START_ELEMENT; + case ENTITY_NODE: + return ENTITY_DECLARATION; + case ENTITY_REFERENCE_NODE: + return ENTITY_REFERENCE; + case NOTATION_NODE: + return NOTATION_DECLARATION; + case PROCESSING_INSTRUCTION_NODE: + return PROCESSING_INSTRUCTION; + case TEXT_NODE: + return CHARACTERS; + default: + throw new RuntimeException("DOMStreamReader: Unexpected node type"); + } + } + + public int next() throws XMLStreamException { + while(true) { + int r = _next(); + switch (r) { + case CHARACTERS: + // if we are currently at text node, make sure that this is a meaningful text node. + Node prev = _current.getPreviousSibling(); + if(prev!=null && prev.getNodeType()==Node.TEXT_NODE) + continue; // nope. this is just a continuation of previous text that should be invisible + + Text t = (Text)_current; + wholeText = t.getWholeText(); + if(wholeText.length()==0) + continue; // nope. this is empty text. + return CHARACTERS; + case START_ELEMENT: + splitAttributes(); + return START_ELEMENT; + default: + return r; + } + } + } + + protected int _next() throws XMLStreamException { + Node child; + + switch (_state) { + case END_DOCUMENT: + throw new IllegalStateException("DOMStreamReader: Calling next() at END_DOCUMENT"); + case START_DOCUMENT: + // Don't skip document element if this is a fragment + if (_current.getNodeType() == ELEMENT_NODE) { + return (_state = START_ELEMENT); + } + + child = _current.getFirstChild(); + if (child == null) { + return (_state = END_DOCUMENT); + } + else { + _current = child; + return (_state = mapNodeTypeToState(_current.getNodeType())); + } + case START_ELEMENT: + child = _current.getFirstChild(); + if (child == null) { + return (_state = END_ELEMENT); + } + else { + _current = child; + return (_state = mapNodeTypeToState(_current.getNodeType())); + } + case END_ELEMENT: + case CHARACTERS: + case COMMENT: + case CDATA: + case ENTITY_REFERENCE: + case PROCESSING_INSTRUCTION: + if (_state == END_ELEMENT) depth--; + // If at the end of this fragment, then terminate traversal + if (_current == _start) { + return (_state = END_DOCUMENT); + } + + Node sibling = _current.getNextSibling(); + if (sibling == null) { + _current = _current.getParentNode(); + // getParentNode() returns null for fragments + _state = (_current == null || _current.getNodeType() == DOCUMENT_NODE) ? + END_DOCUMENT : END_ELEMENT; + return _state; + } + else { + _current = sibling; + return (_state = mapNodeTypeToState(_current.getNodeType())); + } + case DTD: + case ATTRIBUTE: + case NAMESPACE: + default: + throw new RuntimeException("DOMStreamReader: Unexpected internal state"); + } + } + + public int nextTag() throws javax.xml.stream.XMLStreamException { + int eventType = next(); + while (eventType == CHARACTERS && isWhiteSpace() + || eventType == CDATA && isWhiteSpace() + || eventType == SPACE + || eventType == PROCESSING_INSTRUCTION + || eventType == COMMENT) + { + eventType = next(); + } + if (eventType != START_ELEMENT && eventType != END_ELEMENT) { + throw new XMLStreamException("DOMStreamReader: Expected start or end tag"); + } + return eventType; + } + + public void require(int type, String namespaceURI, String localName) + throws javax.xml.stream.XMLStreamException + { + if (type != _state) { + throw new XMLStreamException("DOMStreamReader: Required event type not found"); + } + if (namespaceURI != null && !namespaceURI.equals(getNamespaceURI())) { + throw new XMLStreamException("DOMStreamReader: Required namespaceURI not found"); + } + if (localName != null && !localName.equals(getLocalName())) { + throw new XMLStreamException("DOMStreamReader: Required localName not found"); + } + } + + public boolean standaloneSet() { + return true; + } + + + + // -- Debugging ------------------------------------------------------ +/* + private static void displayDOM(Node node, java.io.OutputStream ostream) { + try { + System.out.println("\n====\n"); + XmlUtil.newTransformer().transform( + new DOMSource(node), new StreamResult(ostream)); + System.out.println("\n====\n"); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void verifyDOMIntegrity(Node node) { + switch (node.getNodeType()) { + case ELEMENT_NODE: + case ATTRIBUTE_NODE: + + // DOM level 1? + if (node.getLocalName() == null) { + System.out.println("WARNING: DOM level 1 node found"); + System.out.println(" -> node.getNodeName() = " + node.getNodeName()); + System.out.println(" -> node.getNamespaceURI() = " + node.getNamespaceURI()); + System.out.println(" -> node.getLocalName() = " + node.getLocalName()); + System.out.println(" -> node.getPrefix() = " + node.getPrefix()); + } + + if (node.getNodeType() == ATTRIBUTE_NODE) return; + + NamedNodeMap attrs = node.getAttributes(); + for (int i = 0; i < attrs.getLength(); i++) { + verifyDOMIntegrity(attrs.item(i)); + } + case DOCUMENT_NODE: + NodeList children = node.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + verifyDOMIntegrity(children.item(i)); + } + } + } +*/ + + private static String fixNull(String s) { + if(s==null) return ""; + else return s; + } +} --- /dev/null 2014-03-28 17:28:59.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/DummyLocation.java 2014-03-28 17:28:59.000000000 +0100 @@ -0,0 +1,55 @@ +/* + * 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 + * 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.org.jvnet.staxex.util; + +import javax.xml.stream.Location; + +/** + * {@link Location} that returns no info. + * + * @author Santiago.PericasGeertsen@sun.com + */ +public final class DummyLocation implements Location { + private DummyLocation() {} + + public static final Location INSTANCE = new DummyLocation(); + + public int getCharacterOffset() { + return -1; + } + public int getColumnNumber() { + return -1; + } + public int getLineNumber() { + return -1; + } + public String getPublicId() { + return null; + } + public String getSystemId() { + return null; + } +} --- /dev/null 2014-03-28 17:29:00.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/FinalArrayList.java 2014-03-28 17:29:00.000000000 +0100 @@ -0,0 +1,46 @@ +/* + * 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 + * 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.org.jvnet.staxex.util; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * {@link ArrayList} with a final marker to help JIT. + * @author Kohsuke Kawaguchi + */ +public final class FinalArrayList extends ArrayList { + public FinalArrayList(int initialCapacity) { + super(initialCapacity); + } + + public FinalArrayList() { + } + + public FinalArrayList(Collection collection) { + super(collection); + } +} --- /dev/null 2014-03-28 17:29:00.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/MtomStreamWriter.java 2014-03-28 17:29:00.000000000 +0100 @@ -0,0 +1,42 @@ +/* + * 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 + * 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.org.jvnet.staxex.util; + +import javax.xml.bind.attachment.AttachmentMarshaller; +import javax.xml.stream.XMLStreamWriter; + +/** + * A {@link XMLStreamWriter} that used for MTOM encoding may provide its own + * {@link AttachmentMarshaller}. The marshaller could do processing based on + * MTOM threshold, and make decisions about inlining the attachment data or not. + * + * @author Jitendra Kotamraju + * @see JAXBMessage + * @see MtomCodec + */ +public interface MtomStreamWriter { + AttachmentMarshaller getAttachmentMarshaller(); +} --- /dev/null 2014-03-28 17:29:00.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxReaderEx.java 2014-03-28 17:29:00.000000000 +0100 @@ -0,0 +1,153 @@ +/* + * 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 + * 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.org.jvnet.staxex.util; + +import java.util.Iterator; + +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPException; +import javax.xml.stream.XMLStreamException; + +import com.sun.xml.internal.org.jvnet.staxex.Base64Data; +import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx; +import com.sun.xml.internal.org.jvnet.staxex.BinaryText; + +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * SaajStaxReaderEx + * + * @author shih-chang.chen@oracle.com + */ +public class SaajStaxReaderEx extends DOMStreamReader implements XMLStreamReaderEx { + //TODO extends com.sun.xml.internal.ws.streaming.DOMStreamReader + private BinaryText binaryText = null; + private Base64Data base64AttData = null; + + public SaajStaxReaderEx(SOAPElement se) { + super(se); + } + + @Override + public int next() throws XMLStreamException { + binaryText = null; + base64AttData = null; + while(true) { + int r = _next(); + switch (r) { + case CHARACTERS: + if (_current instanceof BinaryText) { + binaryText = (BinaryText) _current; + base64AttData = new Base64Data(); + try { + base64AttData.set(binaryText.getDataHandler()); +//System.out.println("--------------- debug SaajStaxReaderEx binaryText " + binaryText); + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } else { + // if we are currently at text node, make sure that this is a meaningful text node. + Node prev = _current.getPreviousSibling(); + if(prev!=null && prev.getNodeType()==Node.TEXT_NODE) + continue; // nope. this is just a continuation of previous text that should be invisible + + Text t = (Text)_current; + wholeText = t.getWholeText(); + if(wholeText.length()==0) + continue; // nope. this is empty text. + } + return CHARACTERS; + case START_ELEMENT: + splitAttributes(); + return START_ELEMENT; + default: + return r; + } + } + } + + @Override + public String getElementTextTrim() throws XMLStreamException { + // TODO Auto-generated method stub + return null; + } + + @Override + public CharSequence getPCDATA() throws XMLStreamException { + return (binaryText != null) ? base64AttData : getText(); + } + + @Override + public com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx getNamespaceContext() { + return new com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx() { + + @Override + public String getNamespaceURI(String prefix) { + return _current.lookupNamespaceURI(prefix); + } + + @Override + public String getPrefix(String uri) { + return _current.lookupPrefix(uri); + } + + @Override + public Iterator getPrefixes(String arg0) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Iterator iterator() { + // TODO Auto-generated method stub + return null; + } + + }; + } + + + @Override + public int getTextLength() { + return (binaryText != null) ? base64AttData.length() : super.getTextLength(); + } + + @Override + public int getTextStart() { + return (binaryText != null) ? 0: super.getTextStart(); + } + + @Override + public char[] getTextCharacters() { + if (binaryText != null) { + char[] chars = new char[base64AttData.length()]; + base64AttData.writeTo(chars, 0); + return chars; + } + return super.getTextCharacters(); + } +} --- /dev/null 2014-03-28 17:29:01.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriter.java 2014-03-28 17:29:00.000000000 +0100 @@ -0,0 +1,330 @@ +/* + * Copyright (c) 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 + * 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.org.jvnet.staxex.util; + +import java.util.Arrays; +import java.util.Iterator; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPMessage; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.w3c.dom.Comment; +import org.w3c.dom.Node; + +/** + * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface. + * + * @author shih-chang.chen@oracle.com + */ +public class SaajStaxWriter implements XMLStreamWriter { + + protected SOAPMessage soap; + protected String envURI; + protected SOAPElement currentElement; + + static final protected String Envelope = "Envelope"; + static final protected String Header = "Header"; + static final protected String Body = "Body"; + static final protected String xmlns = "xmlns"; + + public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException { + soap = msg; + this.envURI = uri; + } + + public SOAPMessage getSOAPMessage() { + return soap; + } + + protected SOAPElement getEnvelope() throws SOAPException { + return soap.getSOAPPart().getEnvelope(); + } + + @Override + public void writeStartElement(final String localName) throws XMLStreamException { + try { + currentElement = currentElement.addChildElement(localName); + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } + + @Override + public void writeStartElement(final String ns, final String ln) throws XMLStreamException { + writeStartElement(null, ln, ns); + } + + @Override + public void writeStartElement(final String prefix, final String ln, final String ns) throws XMLStreamException { + try { + if (envURI.equals(ns)) { + if (Envelope.equals(ln)) { + currentElement = getEnvelope(); + fixPrefix(prefix); + return; + } else if (Header.equals(ln)) { + currentElement = soap.getSOAPHeader(); + fixPrefix(prefix); + return; + } else if (Body.equals(ln)) { + currentElement = soap.getSOAPBody(); + fixPrefix(prefix); + return; + } + } + currentElement = (prefix == null) ? + currentElement.addChildElement(new QName(ns, ln)) : + currentElement.addChildElement(ln, prefix, ns); + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } + + private void fixPrefix(final String prfx) throws XMLStreamException { + String oldPrfx = currentElement.getPrefix(); + if (prfx != null && !prfx.equals(oldPrfx)) { + currentElement.setPrefix(prfx); + } + } + + @Override + public void writeEmptyElement(final String uri, final String ln) throws XMLStreamException { + writeStartElement(null, ln, uri); + } + + @Override + public void writeEmptyElement(final String prefix, final String ln, final String uri) throws XMLStreamException { + writeStartElement(prefix, ln, uri); + } + + @Override + public void writeEmptyElement(final String ln) throws XMLStreamException { + writeStartElement(null, ln, null); + } + + @Override + public void writeEndElement() throws XMLStreamException { + if (currentElement != null) currentElement = currentElement.getParentElement(); + } + + @Override + public void writeEndDocument() throws XMLStreamException { + } + + @Override + public void close() throws XMLStreamException { + } + + @Override + public void flush() throws XMLStreamException { + } + + @Override + public void writeAttribute(final String ln, final String val) throws XMLStreamException { + writeAttribute(null, null, ln, val); + } + + @Override + public void writeAttribute(final String prefix, final String ns, final String ln, final String value) throws XMLStreamException { + try { + if (ns == null) { + if (prefix == null && xmlns.equals(ln)) { + currentElement.addNamespaceDeclaration("", value); + } else { + currentElement.setAttributeNS("", ln, value); + } + } else { + QName name = (prefix == null) ? new QName(ns, ln) : new QName(ns, ln, prefix); + currentElement.addAttribute(name, value); + } + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } + + @Override + public void writeAttribute(final String ns, final String ln, final String val) throws XMLStreamException { + writeAttribute(null, ns, ln, val); + } + + @Override + public void writeNamespace(String prefix, final String uri) throws XMLStreamException { + + // make prefix default if null or "xmlns" (according to javadoc) + if (prefix == null || "xmlns".equals(prefix)) { + prefix = ""; + } + + try { + currentElement.addNamespaceDeclaration(prefix, uri); + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } + + @Override + public void writeDefaultNamespace(final String uri) throws XMLStreamException { + writeNamespace("", uri); + } + + @Override + public void writeComment(final String data) throws XMLStreamException { + Comment c = soap.getSOAPPart().createComment(data); + currentElement.appendChild(c); + } + + @Override + public void writeProcessingInstruction(final String target) throws XMLStreamException { + Node n = soap.getSOAPPart().createProcessingInstruction(target, ""); + currentElement.appendChild(n); + } + + @Override + public void writeProcessingInstruction(final String target, final String data) throws XMLStreamException { + Node n = soap.getSOAPPart().createProcessingInstruction(target, data); + currentElement.appendChild(n); + } + + @Override + public void writeCData(final String data) throws XMLStreamException { + Node n = soap.getSOAPPart().createCDATASection(data); + currentElement.appendChild(n); + } + + @Override + public void writeDTD(final String dtd) throws XMLStreamException { + //TODO ... Don't do anything here + } + + @Override + public void writeEntityRef(final String name) throws XMLStreamException { + Node n = soap.getSOAPPart().createEntityReference(name); + currentElement.appendChild(n); + } + + @Override + public void writeStartDocument() throws XMLStreamException { + } + + @Override + public void writeStartDocument(final String version) throws XMLStreamException { + if (version != null) soap.getSOAPPart().setXmlVersion(version); + } + + @Override + public void writeStartDocument(final String encoding, final String version) throws XMLStreamException { + if (version != null) soap.getSOAPPart().setXmlVersion(version); + if (encoding != null) { + try { + soap.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encoding); + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } + } + + @Override + public void writeCharacters(final String text) throws XMLStreamException { + try { + currentElement.addTextNode(text); + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } + + @Override + public void writeCharacters(final char[] text, final int start, final int len) throws XMLStreamException { + char[] chr = (start == 0 && len == text.length) ? text : Arrays.copyOfRange(text, start, start + len); + try { + currentElement.addTextNode(new String(chr)); + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } + + @Override + public String getPrefix(final String uri) throws XMLStreamException { + return currentElement.lookupPrefix(uri); + } + + @Override + public void setPrefix(final String prefix, final String uri) throws XMLStreamException { + try { + this.currentElement.addNamespaceDeclaration(prefix, uri); + } catch (SOAPException e) { + throw new XMLStreamException(e); + } + } + + @Override + public void setDefaultNamespace(final String uri) throws XMLStreamException { + setPrefix("", uri); + } + + @Override + public void setNamespaceContext(final NamespaceContext context)throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + @Override + public Object getProperty(final String name) throws IllegalArgumentException { + //TODO the following line is to make eclipselink happy ... they are aware of this problem - + if (javax.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES.equals(name)) return Boolean.FALSE; + return null; + } + + @Override + public NamespaceContext getNamespaceContext() { + return new NamespaceContext() { + public String getNamespaceURI(final String prefix) { + return currentElement.getNamespaceURI(prefix); + } + public String getPrefix(final String namespaceURI) { + return currentElement.lookupPrefix(namespaceURI); + } + public Iterator getPrefixes(final String namespaceURI) { + return new Iterator() { + String prefix = getPrefix(namespaceURI); + public boolean hasNext() { + return (prefix != null); + } + public Object next() { + if (!hasNext()) throw new java.util.NoSuchElementException(); + String next = prefix; + prefix = null; + return next; + } + public void remove() {} + }; + } + }; + } +} --- /dev/null 2014-03-28 17:29:01.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriterEx.java 2014-03-28 17:29:01.000000000 +0100 @@ -0,0 +1,244 @@ +/* + * Copyright (c) 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 + * 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.org.jvnet.staxex.util; + +import java.io.OutputStream; +import java.util.Arrays; +import java.util.Iterator; +import java.util.UUID; + +import javax.activation.DataHandler; +import javax.xml.bind.attachment.AttachmentMarshaller; +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPMessage; +import javax.xml.stream.XMLStreamException; + +import com.sun.xml.internal.org.jvnet.staxex.Base64Data; +import com.sun.xml.internal.org.jvnet.staxex.BinaryText; +import com.sun.xml.internal.org.jvnet.staxex.MtomEnabled; +import com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx; +import com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler; +import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx; +// +//import com.sun.xml.internal.ws.api.message.saaj.SaajStaxWriter; +//import com.sun.xml.internal.ws.developer.StreamingDataHandler; +//import com.sun.xml.internal.ws.streaming.MtomStreamWriter; + +/** + * SaajStaxWriterEx converts XMLStreamWriterEx calls to build an orasaaj SOAPMessage with BinaryTextImpl. + * + * @author shih-chang.chen@oracle.com + */ +public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterEx, MtomStreamWriter { + + static final protected String xopNS = "http://www.w3.org/2004/08/xop/include"; + static final protected String Include = "Include"; + static final protected String href = "href"; + + private enum State {xopInclude, others}; + private State state = State.others; + private BinaryText binaryText; + + public SaajStaxWriterEx(SOAPMessage msg, String uri) throws SOAPException { + super(msg, uri); + } + + public void writeStartElement(String prefix, String ln, String ns) throws XMLStreamException { + if (xopNS.equals(ns) && Include.equals(ln)) { + state = State.xopInclude; + return; + } else { + super.writeStartElement(prefix, ln, ns); + } + } + + @Override + public void writeEndElement() throws XMLStreamException { + if (state.equals(State.xopInclude)) { + state = State.others; + } else { + super.writeEndElement(); + } + } + + @Override + public void writeAttribute(String prefix, String ns, String ln, String value) throws XMLStreamException { + if (binaryText != null && href.equals(ln)) { + return; + } else { + super.writeAttribute(prefix, ns, ln, value); + } + } + +// @Override +// public void writeComment(String data) throws XMLStreamException { +// ((ElementImpl)currentElement).addCommentNode(data); +// } +// +// @Override +// public void writeCData(String data) throws XMLStreamException { +// CDataTextImpl cdt = new CDataTextImpl(soap.getSOAPPart(), data); +// currentElement.appendChild(cdt); +// } + + @Override + public NamespaceContextEx getNamespaceContext() { + return new NamespaceContextEx() { + public String getNamespaceURI(String prefix) { + return currentElement.getNamespaceURI(prefix); + } + public String getPrefix(String namespaceURI) { + return currentElement.lookupPrefix(namespaceURI); + } + public Iterator getPrefixes(final String namespaceURI) { + return new Iterator() { + String prefix = getPrefix(namespaceURI); + public boolean hasNext() { + return (prefix != null); + } + public Object next() { + if (prefix == null) throw new java.util.NoSuchElementException(); + String next = prefix; + prefix = null; + return next; + } + public void remove() {} + }; + } + public Iterator iterator() { + return new Iterator() { + public boolean hasNext() { return false; } + public Binding next() { return null; } + public void remove() {} + }; + } + }; + } + + @Override + public void writeBinary(DataHandler data) throws XMLStreamException { +// binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl)soap, null, currentElement.getOwnerDocument(), data); +// currentElement.appendChild(binaryText); + addBinaryText(data); + } + + @Override + public OutputStream writeBinary(String arg0) throws XMLStreamException { + return null; + } + + @Override + public void writeBinary(byte[] data, int offset, int length, String contentType) throws XMLStreamException { +// if (mtomThreshold == -1 || mtomThreshold > length) return null; + byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length); + if (currentElement instanceof MtomEnabled) { + binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes); + } else { + throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement); + } + } + + @Override + public void writePCDATA(CharSequence arg0) throws XMLStreamException { + if (arg0 instanceof Base64Data) { + // The fix of StreamReaderBufferCreator preserves this dataHandler + addBinaryText(((Base64Data) arg0).getDataHandler()); + } else { + // We should not normally get here as we expect a DataHandler, + // but this is the most general solution. If we do get + // something other than a Data Handler, create a Text node with + // the data. Another alternative would be to throw an exception, + // but in the most general case, we don't know whether this input + // is expected. + try { + currentElement.addTextNode(arg0.toString()); + } catch (SOAPException e) { + throw new XMLStreamException("Cannot add Text node", e); + } + } + } + + static private String encodeCid() { + String cid = "example.jaxws.sun.com"; + String name = UUID.randomUUID() + "@"; + return name + cid; + } + + private String addBinaryText(DataHandler data) { + String hrefOrCid = null; + if (data instanceof StreamingDataHandler) { + hrefOrCid = ((StreamingDataHandler) data).getHrefCid(); + } + if (hrefOrCid == null) hrefOrCid = encodeCid(); + + String prefixedCid = (hrefOrCid.startsWith("cid:")) ? hrefOrCid : "cid:" + hrefOrCid; + // Should we do the threshold processing on DataHandler ? But that would be + // expensive as DataHolder need to read the data again from its source + //binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl) soap, prefixedCid, currentElement.getOwnerDocument(), data); + //currentElement.appendChild(binaryText); + if (currentElement instanceof MtomEnabled) { + binaryText = ((MtomEnabled) currentElement).addBinaryText(prefixedCid, data); + } else { + throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement); + } + return hrefOrCid; + } + + public AttachmentMarshaller getAttachmentMarshaller() { + return new AttachmentMarshaller() { + @Override + public String addMtomAttachment(DataHandler data, String ns, String ln) { +// if (mtomThreshold == -1) return null; + String hrefOrCid = addBinaryText(data); +// return binaryText.getHref(); + return hrefOrCid; + } + + @Override + public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String ns, String ln) { +// if (mtomThreshold == -1 || mtomThreshold > length) return null; + byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length); +// binaryText = (BinaryTextImpl) ((ElementImpl) currentElement).addAsBase64TextNode(bytes); + if (currentElement instanceof MtomEnabled) { + binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes); + } else { + throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement); + } + return binaryText.getHref(); + } + + @Override + public String addSwaRefAttachment(DataHandler data) { + return "cid:"+encodeCid(); + } + + @Override + public boolean isXOPPackage() { + return true; + } + }; + } +} --- /dev/null 2014-03-28 17:29:01.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/XMLStreamReaderToXMLStreamWriter.java 2014-03-28 17:29:01.000000000 +0100 @@ -0,0 +1,297 @@ +/* + * 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 + * 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.org.jvnet.staxex.util; + +import java.io.IOException; + +import javax.xml.bind.attachment.AttachmentMarshaller; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; +import javax.xml.XMLConstants; + +import com.sun.xml.internal.org.jvnet.staxex.Base64Data; +import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx; +import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx; + +/** + * Reads a sub-tree from {@link XMLStreamReader} and writes to {@link XMLStreamWriter} + * as-is. + * + *

+ * This class can be sub-classed to implement a simple transformation logic. + * + * @author Kohsuke Kawaguchi + * @author Ryan Shoemaker + */ +public class XMLStreamReaderToXMLStreamWriter { + + static public class Breakpoint { + protected XMLStreamReader reader; + protected XMLStreamWriter writer; + + public Breakpoint(XMLStreamReader r, XMLStreamWriter w) { reader = r; writer = w; } + + public XMLStreamReader reader() { return reader; } + public XMLStreamWriter writer() { return writer; } + public boolean proceedBeforeStartElement() { return true; } + public boolean proceedAfterStartElement() { return true; } + } + + private static final int BUF_SIZE = 4096; + + protected XMLStreamReader in; + protected XMLStreamWriter out; + + private char[] buf; + + boolean optimizeBase64Data = false; + + AttachmentMarshaller mtomAttachmentMarshaller; + + /** + * Reads one subtree and writes it out. + * + *

+ * The {@link XMLStreamWriter} never receives a start/end document event. + * Those need to be written separately by the caller. + */ + public void bridge(XMLStreamReader in, XMLStreamWriter out) throws XMLStreamException { + bridge(in, out, null); + } + + public void bridge(Breakpoint breakPoint) throws XMLStreamException { + bridge(breakPoint.reader(), breakPoint.writer(), breakPoint); + } + + private void bridge(XMLStreamReader in, XMLStreamWriter out, Breakpoint breakPoint) throws XMLStreamException { + assert in!=null && out!=null; + this.in = in; + this.out = out; + + optimizeBase64Data = (in instanceof XMLStreamReaderEx); + + if (out instanceof XMLStreamWriterEx && out instanceof MtomStreamWriter) { + mtomAttachmentMarshaller = ((MtomStreamWriter) out).getAttachmentMarshaller(); + } + // remembers the nest level of elements to know when we are done. + int depth=0; + + buf = new char[BUF_SIZE]; + + // if the parser is at the start tag, proceed to the first element + int event = getEventType(); + + if( event!=XMLStreamConstants.START_ELEMENT) + throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event); + + do { + // These are all of the events listed in the javadoc for + // XMLEvent. + // The spec only really describes 11 of them. + switch (event) { + case XMLStreamConstants.START_ELEMENT : + if (breakPoint != null && !breakPoint.proceedBeforeStartElement()) return; + depth++; + handleStartElement(); + if (breakPoint != null && !breakPoint.proceedAfterStartElement()) return; + break; + case XMLStreamConstants.END_ELEMENT : + handleEndElement(); + depth--; + if(depth==0) + return; + break; + case XMLStreamConstants.CHARACTERS : + handleCharacters(); + break; + case XMLStreamConstants.ENTITY_REFERENCE : + handleEntityReference(); + break; + case XMLStreamConstants.PROCESSING_INSTRUCTION : + handlePI(); + break; + case XMLStreamConstants.COMMENT : + handleComment(); + break; + case XMLStreamConstants.DTD : + handleDTD(); + break; + case XMLStreamConstants.CDATA : + handleCDATA(); + break; + case XMLStreamConstants.SPACE : + handleSpace(); + break; + case XMLStreamConstants.END_DOCUMENT: + throw new XMLStreamException("Malformed XML at depth="+depth+", Reached EOF. Event="+event); + default : + throw new XMLStreamException("Cannot process event: " + event); + } + + event=getNextEvent(); + } while (depth!=0); + } + + protected void handlePI() throws XMLStreamException { + out.writeProcessingInstruction( + in.getPITarget(), + in.getPIData()); + } + + + protected void handleCharacters() throws XMLStreamException { + + CharSequence c = null; + + if (optimizeBase64Data) { + c = ((XMLStreamReaderEx)in).getPCDATA(); + } + + if ((c != null) && (c instanceof Base64Data)) { + if (mtomAttachmentMarshaller != null) { + Base64Data b64d = (Base64Data) c; + ((XMLStreamWriterEx)out).writeBinary(b64d.getDataHandler()); + } else { + try { + ((Base64Data)c).writeTo(out); + } catch (IOException e) { + throw new XMLStreamException(e); + } + } + } else { + for (int start=0,read=buf.length; read == buf.length; start+=buf.length) { + read = in.getTextCharacters(start, buf, 0, buf.length); + out.writeCharacters(buf, 0, read); + } + } + } + + protected void handleEndElement() throws XMLStreamException { + out.writeEndElement(); + } + + protected void handleStartElement() throws XMLStreamException { + String nsUri = in.getNamespaceURI(); + if(nsUri==null) + out.writeStartElement(in.getLocalName()); + else + out.writeStartElement( + fixNull(in.getPrefix()), + in.getLocalName(), + nsUri + ); + + // start namespace bindings + int nsCount = in.getNamespaceCount(); + for (int i = 0; i < nsCount; i++) { + out.writeNamespace( + in.getNamespacePrefix(i), + fixNull(in.getNamespaceURI(i))); // zephyr doesn't like null, I don't know what is correct, so just fix null to "" for now + } + + // write attributes + int attCount = in.getAttributeCount(); + for (int i = 0; i < attCount; i++) { + handleAttribute(i); + } + } + + /** + * Writes out the {@code i}-th attribute of the current element. + * + *

+ * Used from {@link #handleStartElement()}. + */ + protected void handleAttribute(int i) throws XMLStreamException { + String nsUri = in.getAttributeNamespace(i); + String prefix = in.getAttributePrefix(i); + if (fixNull(nsUri).equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) { + //Its a namespace decl, ignore as it is already written. + return; + } + + if(nsUri==null || prefix == null || prefix.equals("")) { + out.writeAttribute( + in.getAttributeLocalName(i), + in.getAttributeValue(i) + ); + } else { + out.writeAttribute( + prefix, + nsUri, + in.getAttributeLocalName(i), + in.getAttributeValue(i) + ); + } + } + + protected void handleDTD() throws XMLStreamException { + out.writeDTD(in.getText()); + } + + protected void handleComment() throws XMLStreamException { + out.writeComment(in.getText()); + } + + protected void handleEntityReference() throws XMLStreamException { + out.writeEntityRef(in.getText()); + } + + protected void handleSpace() throws XMLStreamException { + handleCharacters(); + } + + protected void handleCDATA() throws XMLStreamException { + out.writeCData(in.getText()); + } + + private static String fixNull(String s) { + if(s==null) return ""; + else return s; + } + + private int getEventType() throws XMLStreamException { + int event = in.getEventType(); + // if the parser is at the start tag, proceed to the first element + //Note - need to do this every time because we could be using a composite reader + if(event == XMLStreamConstants.START_DOCUMENT) { + // nextTag doesn't correctly handle DTDs + while( !in.isStartElement() ) { + event = in.next(); + if (event == XMLStreamConstants.COMMENT) + handleComment(); + } + } + return event; + } + + private int getNextEvent() throws XMLStreamException { + in.next(); + return getEventType(); + } +} --- old/src/share/jaxws_classes/com/sun/codemodel/internal/util/MS1252Encoder.java 2014-03-28 17:29:02.000000000 +0100 +++ /dev/null 2014-03-28 17:29:02.000000000 +0100 @@ -1,223 +0,0 @@ -/* - * Copyright (c) 1997, 2012, 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. - */ - -/* - * @(#)$Id: MS1252Encoder.java,v 1.2 2005/09/10 19:07:33 kohsuke Exp $ - */ -package com.sun.codemodel.internal.util; - -import java.nio.charset.Charset; - -/** - * MS1252 encoder that corrects a bug in JDK1.4.2_01. - * - *

- * See - * http://www.microsoft.com/globaldev/reference/sbcs/1252.htm - * for the normative definition. - * - * This code depends on Sun internal package, so we have to make sure - * it won't be executed on other JDKs. - */ -public final class MS1252Encoder extends SingleByteEncoder { - - public MS1252Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u008C\u009C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u008A\u009A\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u008E\u009E\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0083\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0088\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0098\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0096\u0097\u0000" + - "\u0000\u0000\u0091\u0092\u0082\u0000\u0093\u0094" + - "\u0084\u0000\u0086\u0087\u0095\u0000\u0000\u0000" + - "\u0085\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u009B\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0099\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 461, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 698, 920, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - }; - - public boolean canEncode(char c) { - char test = index2.charAt( index1[(c&0xFF00)>>8] + (c&0xFF) ); - return test!=0; - } - -} --- old/src/share/jaxws_classes/com/sun/codemodel/internal/util/SingleByteEncoder.java 2014-03-28 17:29:02.000000000 +0100 +++ /dev/null 2014-03-28 17:29:02.000000000 +0100 @@ -1,159 +0,0 @@ -/* - * Copyright (c) 1997, 2012, 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. - */ - -/* - * @(#)SingleByteEncoder.java 1.14 03/01/23 - */ - -package com.sun.codemodel.internal.util; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CoderResult; - -import sun.nio.cs.Surrogate; - - -abstract class SingleByteEncoder - extends CharsetEncoder -{ - - private final short index1[]; - private final String index2; - private final int mask1; - private final int mask2; - private final int shift; - - private final Surrogate.Parser sgp = new Surrogate.Parser(); - - protected SingleByteEncoder(Charset cs, - short[] index1, String index2, - int mask1, int mask2, int shift) - { - super(cs, 1.0f, 1.0f); - this.index1 = index1; - this.index2 = index2; - this.mask1 = mask1; - this.mask2 = mask2; - this.shift = shift; - } - - public boolean canEncode(char c) { - char testEncode; - testEncode = index2.charAt(index1[(c & mask1) >> shift] - + (c & mask2)); - if (testEncode == '\u0000') - return false; - else - return true; - } - - private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) { - char[] sa = src.array(); - int sp = src.arrayOffset() + src.position(); - int sl = src.arrayOffset() + src.limit(); - sp = (sp <= sl ? sp : sl); - byte[] da = dst.array(); - int dp = dst.arrayOffset() + dst.position(); - int dl = dst.arrayOffset() + dst.limit(); - dp = (dp <= dl ? dp : dl); - - try { - while (sp < sl) { - char c = sa[sp]; - if (Surrogate.is(c)) { - if (sgp.parse(c, sa, sp, sl) < 0) - return sgp.error(); - return sgp.unmappableResult(); - } - if (c >= '\uFFFE') - return CoderResult.unmappableForLength(1); - if (dl - dp < 1) - return CoderResult.OVERFLOW; - - char e = index2.charAt(index1[(c & mask1) >> shift] - + (c & mask2)); - - // If output byte is zero because input char is zero - // then character is mappable, o.w. fail - if (e == '\u0000' && c != '\u0000') - return CoderResult.unmappableForLength(1); - - sp++; - da[dp++] = (byte)e; - } - return CoderResult.UNDERFLOW; - } finally { - src.position(sp - src.arrayOffset()); - dst.position(dp - dst.arrayOffset()); - } - } - - private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) { - int mark = src.position(); - try { - while (src.hasRemaining()) { - char c = src.get(); - if (Surrogate.is(c)) { - if (sgp.parse(c, src) < 0) - return sgp.error(); - return sgp.unmappableResult(); - } - if (c >= '\uFFFE') - return CoderResult.unmappableForLength(1); - if (!dst.hasRemaining()) - return CoderResult.OVERFLOW; - - char e = index2.charAt(index1[(c & mask1) >> shift] - + (c & mask2)); - - // If output byte is zero because input char is zero - // then character is mappable, o.w. fail - if (e == '\u0000' && c != '\u0000') - return CoderResult.unmappableForLength(1); - - mark++; - dst.put((byte)e); - } - return CoderResult.UNDERFLOW; - } finally { - src.position(mark); - } - } - - protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) { - if (true && src.hasArray() && dst.hasArray()) - return encodeArrayLoop(src, dst); - else - return encodeBufferLoop(src, dst); - } - - public byte encode(char inputChar) { - return (byte)index2.charAt(index1[(inputChar & mask1) >> shift] + - (inputChar & mask2)); - } -} --- old/src/share/jaxws_classes/com/sun/codemodel/internal/util/Surrogate.java 2014-03-28 17:29:02.000000000 +0100 +++ /dev/null 2014-03-28 17:29:02.000000000 +0100 @@ -1,355 +0,0 @@ -/* - * Copyright (c) 1997, 2012, 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.codemodel.internal.util; - -import java.nio.CharBuffer; -import java.nio.charset.CoderResult; - - -/** - * Utility class for dealing with surrogates. - * - * @author Mark Reinhold - * @version 1.11, 03/01/23 - */ - -class Surrogate { - - private Surrogate() { } - - // UTF-16 surrogate-character ranges - // - public static final char MIN_HIGH = '\uD800'; - public static final char MAX_HIGH = '\uDBFF'; - public static final char MIN_LOW = '\uDC00'; - public static final char MAX_LOW = '\uDFFF'; - public static final char MIN = MIN_HIGH; - public static final char MAX = MAX_LOW; - - // Range of UCS-4 values that need surrogates in UTF-16 - // - public static final int UCS4_MIN = 0x10000; - public static final int UCS4_MAX = (1 << 20) + UCS4_MIN - 1; - - /** - * Tells whether or not the given UTF-16 value is a high surrogate. - */ - public static boolean isHigh(int c) { - return (MIN_HIGH <= c) && (c <= MAX_HIGH); - } - - /** - * Tells whether or not the given UTF-16 value is a low surrogate. - */ - public static boolean isLow(int c) { - return (MIN_LOW <= c) && (c <= MAX_LOW); - } - - /** - * Tells whether or not the given UTF-16 value is a surrogate character, - */ - public static boolean is(int c) { - return (MIN <= c) && (c <= MAX); - } - - /** - * Tells whether or not the given UCS-4 character must be represented as a - * surrogate pair in UTF-16. - */ - public static boolean neededFor(int uc) { - return (uc >= UCS4_MIN) && (uc <= UCS4_MAX); - } - - /** - * Returns the high UTF-16 surrogate for the given UCS-4 character. - */ - public static char high(int uc) { - return (char)(0xd800 | (((uc - UCS4_MIN) >> 10) & 0x3ff)); - } - - /** - * Returns the low UTF-16 surrogate for the given UCS-4 character. - */ - public static char low(int uc) { - return (char)(0xdc00 | ((uc - UCS4_MIN) & 0x3ff)); - } - - /** - * Converts the given surrogate pair into a 32-bit UCS-4 character. - */ - public static int toUCS4(char c, char d) { - return (((c & 0x3ff) << 10) | (d & 0x3ff)) + 0x10000; - } - - /** - * Surrogate parsing support. Charset implementations may use instances of - * this class to handle the details of parsing UTF-16 surrogate pairs. - */ - public static class Parser { - - public Parser() { } - - private int character; // UCS-4 - private CoderResult error = CoderResult.UNDERFLOW; - private boolean isPair; - - /** - * Returns the UCS-4 character previously parsed. - */ - public int character() { - return character; - } - - /** - * Tells whether or not the previously-parsed UCS-4 character was - * originally represented by a surrogate pair. - */ - public boolean isPair() { - return isPair; - } - - /** - * Returns the number of UTF-16 characters consumed by the previous - * parse. - */ - public int increment() { - return isPair ? 2 : 1; - } - - /** - * If the previous parse operation detected an error, return the object - * describing that error. - */ - public CoderResult error() { - return error; - } - - /** - * Returns an unmappable-input result object, with the appropriate - * input length, for the previously-parsed character. - */ - public CoderResult unmappableResult() { - return CoderResult.unmappableForLength(isPair ? 2 : 1); - } - - /** - * Parses a UCS-4 character from the given source buffer, handling - * surrogates. - * - * @param c The first character - * @param in The source buffer, from which one more character - * will be consumed if c is a high surrogate - * - * @return Either a parsed UCS-4 character, in which case the isPair() - * and increment() methods will return meaningful values, or - * -1, in which case error() will return a descriptive result - * object - */ - public int parse(char c, CharBuffer in) { - if (isHigh(c)) { - if (!in.hasRemaining()) { - error = CoderResult.UNDERFLOW; - return -1; - } - char d = in.get(); - if (isLow(d)) { - character = toUCS4(c, d); - isPair = true; - error = null; - return character; - } - error = CoderResult.malformedForLength(1); - return -1; - } - if (isLow(c)) { - error = CoderResult.malformedForLength(1); - return -1; - } - character = c; - isPair = false; - error = null; - return character; - } - - /** - * Parses a UCS-4 character from the given source buffer, handling - * surrogates. - * - * @param c The first character - * @param ia The input array, from which one more character - * will be consumed if c is a high surrogate - * @param ip The input index - * @param il The input limit - * - * @return Either a parsed UCS-4 character, in which case the isPair() - * and increment() methods will return meaningful values, or - * -1, in which case error() will return a descriptive result - * object - */ - public int parse(char c, char[] ia, int ip, int il) { - if (isHigh(c)) { - if (il - ip < 2) { - error = CoderResult.UNDERFLOW; - return -1; - } - char d = ia[ip + 1]; - if (isLow(d)) { - character = toUCS4(c, d); - isPair = true; - error = null; - return character; - } - error = CoderResult.malformedForLength(1); - return -1; - } - if (isLow(c)) { - error = CoderResult.malformedForLength(1); - return -1; - } - character = c; - isPair = false; - error = null; - return character; - } - - } - - /** - * Surrogate generation support. Charset implementations may use instances - * of this class to handle the details of generating UTF-16 surrogate - * pairs. - */ - public static class Generator { - - public Generator() { } - - private CoderResult error = CoderResult.OVERFLOW; - - /** - * If the previous generation operation detected an error, return the - * object describing that error. - */ - public CoderResult error() { - return error; - } - - /** - * Generates one or two UTF-16 characters to represent the given UCS-4 - * character. - * - * @param uc The UCS-4 character - * @param len The number of input bytes from which the UCS-4 value - * was constructed (used when creating result objects) - * @param dst The destination buffer, to which one or two UTF-16 - * characters will be written - * - * @return Either a positive count of the number of UTF-16 characters - * written to the destination buffer, or -1, in which case - * error() will return a descriptive result object - */ - public int generate(int uc, int len, CharBuffer dst) { - if (uc <= 0xffff) { - if (is(uc)) { - error = CoderResult.malformedForLength(len); - return -1; - } - if (dst.remaining() < 1) { - error = CoderResult.OVERFLOW; - return -1; - } - dst.put((char)uc); - error = null; - return 1; - } - if (uc < UCS4_MIN) { - error = CoderResult.malformedForLength(len); - return -1; - } - if (uc <= UCS4_MAX) { - if (dst.remaining() < 2) { - error = CoderResult.OVERFLOW; - return -1; - } - dst.put(high(uc)); - dst.put(low(uc)); - error = null; - return 2; - } - error = CoderResult.unmappableForLength(len); - return -1; - } - - /** - * Generates one or two UTF-16 characters to represent the given UCS-4 - * character. - * - * @param uc The UCS-4 character - * @param len The number of input bytes from which the UCS-4 value - * was constructed (used when creating result objects) - * @param da The destination array, to which one or two UTF-16 - * characters will be written - * @param dp The destination position - * @param dl The destination limit - * - * @return Either a positive count of the number of UTF-16 characters - * written to the destination buffer, or -1, in which case - * error() will return a descriptive result object - */ - public int generate(int uc, int len, char[] da, int dp, int dl) { - if (uc <= 0xffff) { - if (is(uc)) { - error = CoderResult.malformedForLength(len); - return -1; - } - if (dl - dp < 1) { - error = CoderResult.OVERFLOW; - return -1; - } - da[dp] = (char)uc; - error = null; - return 1; - } - if (uc < UCS4_MIN) { - error = CoderResult.malformedForLength(len); - return -1; - } - if (uc <= UCS4_MAX) { - if (dl - dp < 2) { - error = CoderResult.OVERFLOW; - return -1; - } - da[dp] = high(uc); - da[dp + 1] = low(uc); - error = null; - return 2; - } - error = CoderResult.unmappableForLength(len); - return -1; - } - - } - -} --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/CommentImpl.java 2014-03-28 17:29:02.000000000 +0100 +++ /dev/null 2014-03-28 17:29:02.000000000 +0100 @@ -1,114 +0,0 @@ -/* - * Copyright (c) 1997, 2013, 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.messaging.saaj.soap.impl; - -import java.util.ResourceBundle; -import java.util.logging.Logger; - -import javax.xml.soap.SOAPElement; -import javax.xml.soap.SOAPException; - -import org.w3c.dom.DOMException; -import org.w3c.dom.Text; - -import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; -import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants; - -public class CommentImpl - extends com.sun.org.apache.xerces.internal.dom.CommentImpl - implements javax.xml.soap.Text, org.w3c.dom.Comment { - - protected static final Logger log = - Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, - "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); - protected static ResourceBundle rb = - log.getResourceBundle(); - - public CommentImpl(SOAPDocumentImpl ownerDoc, String text) { - super(ownerDoc, text); - } - - public String getValue() { - String nodeValue = getNodeValue(); - return (nodeValue.equals("") ? null : nodeValue); - } - - public void setValue(String text) { - setNodeValue(text); - } - - - public void setParentElement(SOAPElement element) throws SOAPException { - if (element == null) { - log.severe("SAAJ0112.impl.no.null.to.parent.elem"); - throw new SOAPException("Cannot pass NULL to setParentElement"); - } - ((ElementImpl) element).addNode(this); - } - - public SOAPElement getParentElement() { - return (SOAPElement) getParentNode(); - } - - public void detachNode() { - org.w3c.dom.Node parent = getParentNode(); - if (parent != null) { - parent.removeChild(this); - } - } - - public void recycleNode() { - detachNode(); - // TBD - // - add this to the factory so subsequent - // creations can reuse this object. - } - - public boolean isComment() { - return true; - } - - public Text splitText(int offset) throws DOMException { - log.severe("SAAJ0113.impl.cannot.split.text.from.comment"); - throw new UnsupportedOperationException("Cannot split text from a Comment Node."); - } - - public Text replaceWholeText(String content) throws DOMException { - log.severe("SAAJ0114.impl.cannot.replace.wholetext.from.comment"); - throw new UnsupportedOperationException("Cannot replace Whole Text from a Comment Node."); - } - - public String getWholeText() { - //TODO: maybe we have to implement this in future. - throw new UnsupportedOperationException("Not Supported"); - } - - public boolean isElementContentWhitespace() { - //TODO: maybe we have to implement this in future. - throw new UnsupportedOperationException("Not Supported"); - } - -} --- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/TextImpl.java 2014-03-28 17:29:03.000000000 +0100 +++ /dev/null 2014-03-28 17:29:03.000000000 +0100 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1997, 2013, 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.messaging.saaj.soap.impl; - -import java.util.logging.Logger; - -import javax.xml.soap.SOAPElement; -import javax.xml.soap.SOAPException; - -import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; -import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants; - -public class TextImpl - extends com.sun.org.apache.xerces.internal.dom.TextImpl - implements javax.xml.soap.Text, org.w3c.dom.Text { - - protected static final Logger log = - Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, - "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); - - public TextImpl(SOAPDocumentImpl ownerDoc, String text) { - super(ownerDoc, text); - } - - public String getValue() { - String nodeValue = getNodeValue(); - return (nodeValue.equals("") ? null : nodeValue); - } - - public void setValue(String text) { - setNodeValue(text); - } - - public void setParentElement(SOAPElement parent) throws SOAPException { - if (parent == null) { - log.severe("SAAJ0126.impl.cannot.locate.ns"); - throw new SOAPException("Cannot pass NULL to setParentElement"); - } - ((ElementImpl) parent).addNode(this); - } - - public SOAPElement getParentElement() { - return (SOAPElement) getParentNode(); - } - - - public void detachNode() { - org.w3c.dom.Node parent = getParentNode(); - if (parent != null) { - parent.removeChild(this); - } - } - - public void recycleNode() { - detachNode(); - // TBD - // - add this to the factory so subsequent - // creations can reuse this object. - } - - public boolean isComment() { - String txt = getNodeValue(); - if (txt == null) { - return false; - } - return txt.startsWith(""); - } -}